VS:EqPt2D: Difference between revisions

From Vectorworks Developer
Jump to navigation Jump to search
m (1 revision)
(add examples and comment)
Line 40: Line 40:


-----------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------
<remark></remark>
<remark>
([[User:CBM-c-|_c_]], 2022.01.21) :
* Python: contrary to most Pascal-derived vectorial routines, it accepts also a bidimensional tuple without returning gibberish: the third item will always be ignored.
* Python and Pascal: Don't pass 0 to the toleranz, or the routine will return false.
 
</remark>


-----------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------
<sample></sample>
<sample>
 
==== Vectorscript ====
<code lang="pas">
 
PROCEDURE Example;
VAR
    v1, v2 : VECTOR;
BEGIN
    v1.x := 12; v1.y := 1; { vector can be bidimensional without failure }
    v2.x := 12; v2.y := 1;
    Message(Concat( EqPt2D(v1, v2, 0.1) )); {True }
END;
Run(Example);
</code>
 
==== Python ====
<code lang="py">
v1 = (12, 1, 987) # 3-dimensional tuples: the 3rd item will be ignored
v2 = (12, 1, 0)
vs.Message( str(vs.EqPt2D(v1, v2, 0.1)) ) # True
</code>
</sample>


-----------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------
<seeAlso></seeAlso>
<seeAlso>
VS Functions:
* [[VS:EqualPt]]
* [[VS:EqPt]]
* [[VS:EqPt3D]]
</seeAlso>


-----------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------

Revision as of 08:23, 21 January 2022

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

Description

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

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

Parameters

pt1 VECTOR
pt2 VECTOR
tolerance REAL

Remarks

(_c_, 2022.01.21) :

  • Python: contrary to most Pascal-derived vectorial routines, it accepts also a bidimensional tuple without returning gibberish: the third item will always be ignored.
  • Python and Pascal: Don't pass 0 to the toleranz, or the routine will return false.

Example

Vectorscript


PROCEDURE Example;
VAR
    v1, v2 : VECTOR;
BEGIN
    v1.x := 12; v1.y := 1; { vector can be bidimensional without failure }
    v2.x := 12; v2.y := 1;
    Message(Concat( EqPt2D(v1, v2, 0.1) )); {True }
END;
Run(Example);

Python

v1 = (12, 1, 987) # 3-dimensional tuples: the 3rd item will be ignored
v2 = (12, 1, 0)
vs.Message( str(vs.EqPt2D(v1, v2, 0.1)) ) # True

Version

Availability: from Vectorworks 2014

See Also

VS Functions:

VS Functions:
  • [[VS:EqualPt]]
  • [[VS:EqPt]]
  • [[VS:EqPt3D]]