Skip to content

Latest commit

 

History

History
76 lines (64 loc) · 1.62 KB

File metadata and controls

76 lines (64 loc) · 1.62 KB

EqPt

Description

Returns TRUE if the 2D points are equal within the tolerance.

FUNCTION EqPt(
				pt1       : VECTOR;
				pt2       : VECTOR;
				tolerance : REAL): BOOLEAN;
def vs.EqPt(pt1, pt2, tolerance):
    return BOOLEAN

Parameters

Name Type Description
pt1 VECTOR
pt2 VECTOR
tolerance REAL

Remarks

(_c_, 2022.01.21) Tolerance must be <> 0. By a tolerance of 0 EqPt will always return false. In Python, contrary to most Pascal-derived vectorial routines, EqPt accepts also a bidimensional tuple without returning gibberish: the third item will always be ignored. So this is a 2D-only routine.

Examples

VectorScript

PROCEDURE Example;
VAR
    v1, v2 : VECTOR;
BEGIN
    v1.x := 12; v1.y := 1;
    v2.x := 12; v2.y := 1;
    Message(Concat( EqPt(v1, v2, 0.1) ));
END;
Run(Example);

Python

v1 = (12, 1, 999) # z vals in 3-dimensional tuples will be ignored
v2 = (12, 1, 0)
vs.Message( str(vs.EqPt(v1, v2, 0.1)) )
IF EqPt( UnitVec( vec1 ), UnitVec( vec2 ), fuzz ) THEN tanAng := 0; { AngBVec gives wrong output sometimes for collinear vectors. }
import vs

# Returns TRUE if the 2D points are equal within the tolerance.
pt1 = (0, 0)
pt2 = (1, 1)
tolerance = 1.0

ok = vs.EqPt(pt1, pt2, tolerance)
if ok:
    vs.Message('EqPt succeeded')
else:
    vs.Message('EqPt failed')

See Also

VS Functions:

Version

Availability: from Vectorworks 2014

Category