Distance Graphic Calculation 

Declaration:

FUNCTION   Distance
(   x1 :REAL;
    y1 :REAL;
    x2 :REAL;
    y2 :REAL
) :REAL ;

Description:

Function Distance returns the distance between the two specified coordinate locations.

Parameters:

x1 X coordinate of first point.
y1 Y coordinate of first point.
x2 X coordinate of second point.
y2 Y coordinate of second point.

Example:

d:=Distance(0,2,4,5);
{returns the distance between (0,2) and (4,5)}

See Also:

Norm  



  EllipseEllipseIntersect Graphic Calculation 

Declaration:

FUNCTION   EllipseEllipseIntersect
(   upperLeft1 :POINT;
    lowerRight1 :POINT;
    upperLeft2 :POINT;
    lowerRight2 :POINT;
  VAR  int1 :POINT;
  VAR  int2 :POINT;
  VAR  int3 :POINT;
  VAR  int4 :POINT
) :INTEGER ;

Description:

Calculates the intersections between the two specified ellipses.

Parameters:

upperLeft1 Upper-left point of the first ellipse
lowerRight1 Lower-right point of the first ellipse
upperLeft2 Upper-left point of the second ellipse
lowerRight2 Lower-right point of the second ellipse
int1 On return, first point of intersection, if found
int2 On return, second point of intersection, if found
int3 On return, third point of intersection, if found
int4 On return, fourth point of intersection, if found

Result:

Returns the number of valid intersection points. If the return value is n, the first n points are valid. For example, if the return value is 1, the int1 parameter contains a valid point of intersection, and int2, int3, and int4 are invalid. If the return value is 3, int1, int2, and int3 contain valid points, and int4 is invalid.

Example:

PROCEDURE Example;
VAR
	h1, h2 :HANDLE;
	upperLeft1, lowerRight1 :POINT;
	upperLeft2, lowerRight2 :POINT;
	int1, int2, int3, int4 :POINT;
	num :INTEGER;
BEGIN
	CallTool(-205); h1 := FSActLayer;
	CallTool(-205); h2 := FSActLayer;
	GetBBox(h1, upperLeft1.x, upperLeft1.y, lowerRight1.x, lowerRight1.y);
	GetBBox(h2, upperLeft2.x, upperLeft2.y, lowerRight2.x, lowerRight2.y);
	num := EllipseEllipseIntersect(upperLeft1, lowerRight1, upperLeft2, lowerRight2, int1, int2, int3, int4);
	Message(num);
	Locus(int1.x, int1.y);
	Locus(int2.x, int2.y);
	Locus(int3.x, int3.y);
	Locus(int4.x, int4.y);
END;
RUN(Example);



  EqualPt Graphic Calculation 

Declaration:

FUNCTION   EqualPt
(   p1X :REAL;
    p1Y :REAL;
    p2X :REAL;
    p2Y :REAL
) :BOOLEAN ;

Description:

Function EqualPt returns whether the two specified coordinate locations are equal (i.e., the same point, to 12 significant digits).

Parameters:

p1 Coordinates of first comparison point.
p2 Coordinates of second comparison point.

Example:

PROCEDURE Example;
VAR
	x1, y1, x2, y2 :REAL;
BEGIN
	x1 := 1;
	y1 := 1;
	x2 := 1.0000000000001;
	y2 := 1.0000000000001;
	Message(EqualPt(x1, y1, x2, y2));
END;
RUN(Example);



  EqualRect Graphic Calculation 

Declaration:

FUNCTION   EqualRect
(   rectAp1X :REAL;
    rectAp1Y :REAL;
    rectAp2X :REAL;
    rectAp2Y :REAL;
    rectBp1X :REAL;
    rectBp1Y :REAL;
    rectBp2X :REAL;
    rectBp2Y :REAL
) :BOOLEAN ;

Description:

Function EqualRect returns whether the two specified rectangular areas are equal.

Parameters:

rectAp1 Top left coordinate of rectangle A.
rectAp2 Bottom right coordinate of rectangle A.
rectBp1 Top left coordinate of rectangle B.
rectBp2 Bottom right coordinate of rectangle B.

Example:

AreTheyEqual:=EqualRect(0,0,3,3,3,3,0,0);



  HCenter Graphic Calculation 

Declaration:

PROCEDURE   HCenter
(   h :HANDLE;
  VAR  pX :REAL;
  VAR  pY :REAL
) ;

Description:

Procedure HCenter returns the logical center point of the object specified in h. For most objects, this is the center of the bounding box. For circles, arcs, and round walls HCenter returns the arc center of the object.

Parameters:

h Handle to object.
p X-Y location of object center.



  LineEllipseIntersect Graphic Calculation 

Declaration:

PROCEDURE   LineEllipseIntersect
(   a1 :POINT;
    a2 :POINT;
    upperRight :POINT;
    lowerLeft :POINT;
  VAR  int1 :POINT;
  VAR  legal1 :BOOLEAN;
  VAR  int2 :POINT;
  VAR  legal2 :BOOLEAN
) ;

Description:

Calculates the intersection between the specified line and ellipse.

Parameters:

a1 Start point of the line
a2 End point of the line
upperRight Upper-right point of the ellipse
lowerLeft Lower-left point of the ellipse
int1 On return, first point of intersection, if found
legal1 On return, second point of intersection, if found
int2 On return, indicates that int1 is a valid point of intersection
legal2 On return, indicates that int2 is a valid point of intersection



  LineLineIntersection Graphic Calculation 

Declaration:

PROCEDURE   LineLineIntersection
(   l1start :POINT;
    l1end :POINT;
    l2start :POINT;
    l2end :POINT;
  VAR  parallel :BOOLEAN;
  VAR  intOnLines :BOOLEAN;
  VAR  sectpt :POINT
) ;

Description:

Returns intersection point of the two specified lines. parallel is true if the lines are parallel. intOnLines is true if the intersection is on both lines.

Parameters:

l1start Start point of the first line
l1end End point of the first line
l2start Start point of the second line
l2end End point of the second line
parallel On return, true if the lines are parellel, false otherwise
intOnLines On return, true if the lines intersect
sectpt On return, point of intersection of the lines, if the lines intersect

Example:

PROCEDURE Example;
VAR
   pt1, pt2, pt3, pt4, pt5 :POINT;
   parallel, intOnLines :BOOLEAN; 

BEGIN
   CallTool(-201); 
   GetSegPt1(FSActLayer, pt1.x, pt1.y); 
   GetSegPt2(FSActLayer, pt2.x, pt2.y); 
   CallTool(-201); 
   GetSegPt1(FSActLayer, pt3.x, pt3.y); 
   GetSegPt2(FSActLayer, pt4.x, pt4.y); 
   LineLineIntersection(pt1, pt2, pt3, pt4, parallel, intOnLines, pt5); 
   Locus(pt5.x, pt5.y);
END;
RUN(Example);



  PtInPoly Graphic Calculation 

Declaration:

FUNCTION   PtInPoly
(   pX :REAL;
    pY :REAL;
    h :HANDLE
) :BOOLEAN ;

Description:

Function PtInPoly returns TRUE if the point specified point lies within, or on, the referenced polygon or polyline object.

Parameters:

p X-Y coordinate point.
h Handle to polygon.

Example:

PROCEDURE Example;
VAR
	polyHandle :HANDLE;
	locusHandle :HANDLE;
	x, y :REAL;
BEGIN
	CallTool(-204); polyHandle := FSActLayer;
	CallTool(-221); locusHandle := FSActLayer;
	GetLocPt(locusHandle, x, y);
	Message(PtInPoly(x, y, polyHandle));
END;
RUN(Example);



  PtInRect Graphic Calculation 

Declaration:

FUNCTION   PtInRect
(   pointX :REAL;
    pointY :REAL;
    rect1X :REAL;
    rect1Y :REAL;
    rect2X :REAL;
    rect2Y :REAL
) :BOOLEAN ;

Description:

Function PtInRect returns whether the coordinate location is located within the specified rectangular boundary.

Parameters:

point X-Y coordinate point location.
rect1 Top left coordinate of rectangular area.
rect2 Bottom right coordinate of rectangular area.

Example:

PROCEDURE Example;
VAR
	pointX, pointY, rect1X, rect1Y, rect2X, rect2Y :REAL;
BEGIN
	pointX := 1;
	pointY := 1;
	rect1X := 0;
	rect1Y := 2;
	rect2X := 2;
	rect2Y := 0;
	Message(PtInRect(pointX, pointY, rect1X, rect1Y, rect2X, rect2Y));
END;
RUN(Example);



  Split2DObjectByLine Graphic Calculation 

Declaration:

PROCEDURE   Split2DObjectByLine
(   objectHd :HANDLE;
    p1X :REAL;
    p1Y :REAL;
    p2X :REAL;
    p2Y :REAL;
  VAR  listHds :HANDLE
) ;

Description:

Splits objectHd along a line defined by the two points.

Example:

PROCEDURE Example;
VAR
   polyHandle :HANDLE;
   lineHandle :HANDLE;
   resultHandle :HANDLE;
   begPt :VECTOR;
   endPt :VECTOR;
BEGIN
   CallTool(-204); polyHandle := FSActLayer;
   CallTool(-201); lineHandle := FSActLayer;
   GetSegPt1(lineHandle, begPt.x, begPt.y);
   GetSegPt2(lineHandle, endPt.x, endPt.y);
   Split2DObjectByLine(polyHandle, begPt.x, begPt.y, endPt.x, endPt.y, resultHandle);
   resultHandle := CreateDuplicateObject(resultHandle, NIL);
END;
RUN(Example);



  SrndArea Graphic Calculation 

Declaration:

FUNCTION   SrndArea
(   pX :REAL;
    pY :REAL
) :REAL ;

Description:

Function SrndArea when given a point, returns the area of the smallest polygon bounded by the selected objects.

Parameters:

p Coordinates of reference point.



  UnionRect Graphic Calculation 

Declaration:

PROCEDURE   UnionRect
(   p1X :REAL;
    p1Y :REAL;
    p2X :REAL;
    p2Y :REAL;
    p3X :REAL;
    p3Y :REAL;
    p4X :REAL;
    p4Y :REAL;
  VAR  p5X :REAL;
  VAR  p5Y :REAL;
  VAR  p6X :REAL;
  VAR  p6Y :REAL
) ;

Description:

Procedure UnionRect returns a rectangle based on the boundary enclosing the two specified rectangles.


Parameters:

p1 Top left coordinate of rectangle 1.
p2 Bottom right coordinate of rectangle 1.
p3 Top left coordinate of rectangle 2.
p4 Bottom right coordinate of rectangle 2.
p5 Top left coordinate of boundary rectangle.
p6 Bottom right coordinate of boundary rectangle.

Example:

UnionRect(0,0,3,3,3,3,5,5,x1,y1,x2,y2);