2

私は Prolog の新しいユーザーです。マップの座標をスケーリングおよび変換しようとしていますが、スケーリングと変換 RULEで「十分にインスタンス化されていません」というエラーが発生しました。これが私のルールです。引数が十分にインスタンス化されていないようです。この問題を解決する方法を教えてください。問題は、「IS」演算子を使用するスケールと変換ルールにあります

transform_all :-
   forall(
      representation(Id, Geom),
      (  transform(Geom, TGeom),
         record_transformed_rep(Id, TGeom)
      )
   ).
transform_all :-
    forall(
       (  representation(Id, Geom),
          not(transformed_rep(Id))
       ),
       (  transform(Geom, TGeom),
          record_transformed_rep(Id, TGeom)
       )
    ).

%transformation
transform(Geom, TGeom) :-
   scale(Geom, value(10000), SGeom),
   translate(SGeom, value(-7.5, -51.9), TGeom).

%record_the_transformed_geometries
record_transformed_rep(Id, TGeom) :-
   retractall(representation(Id, _)),
   assert(representation(Id, TGeom)),
   assert(transformed_rep(Id)).  %% flag to avoid infinite loop

%scale_and_translate_metric_Map
scale(point(X,Y), value(V), point(Sx,Sy)) :-
   Sx is X * V,
   Sy is Y * V.

scale(polyline([]), value(_), polyline([])).
scale(polyline([P|R]), value(V), polyline([Sp|Sr])) :-
   scale(P,value(V),Sp),
   scale(polyline(R), value(V), polyline(Sr)).

%translate_coordinate_of_metric_map
translate(point(X,Y), value(Dx,Dy), point(Sx,Sy)) :-
   Sx is X + Dx,
   Sy is Y + Dy.

translate(polyline([]), value(_,_), polyline([])).
translate(polyline([P|R]), value(Dx,Dy), polyline([Sp|Sr])) :-
   translate(P,value(Dx,Dy),Sp),
   translate(polyline(R), value(Dx,Dy), polyline(Sr)). 
4

0 に答える 0