VS:ClosestPoints: Difference between revisions

From Vectorworks Developer
Jump to navigation Jump to search
m (1 revision)
 
m (1 revision)
(No difference)

Revision as of 14:25, 12 August 2013

.VectorScript|VectorScript ..VS:Function Reference|Function Reference ..VS:Function_Reference_Appendix|Appendix

Description

Finds the closest points between two objects.

PROCEDURE ClosestPoints(
h1 :HANDLE;
h2 :HANDLE;
VAR pt1X, pt1Y, pt1Z :REAL;
VAR pt2X, pt2Y, pt2Z :REAL;
VAR touching :BOOLEAN);
def vs.ClosestPoints(h1, h2):
    return (pt1, pt2, touching)

Parameters

h1 HANDLE
h2 HANDLE
pt1X, pt1Y, pt1Z REAL Output parameter.
pt2X, pt2Y, pt2Z REAL Output parameter.
touching BOOLEAN Output parameter.

Example

PROCEDURE Example;
VAR
   x, y     :INTEGER;
   h1, h2   :HANDLE;
   pt1, pt2 :VECTOR;
   ok       :BOOLEAN;
BEGIN
   h1 := FSActLayer;
   SetDSelect(h1);
   
   h2 := FSActLayer;
   SetDSelect(h2);
      
   IF (h1 = NIL) | (h2 = NIL) THEN
      AlrtDialog('select two objects')
   ELSE BEGIN
      ClosestPoints(h1, h2, pt1, pt2, ok);
      Locus(pt1.x, pt1.y);
      Locus(pt2.x, pt2.y);
      Message('Touching=', ok);
   END;   
END;
RUN(Example);

Version

Availability: from All Versions

This is drop-in function.