VS:EqPt: Difference between revisions
Jump to navigation
Jump to search
(add example, comment) |
(add see also, examples) |
||
Line 48: | Line 48: | ||
<sample> | <sample> | ||
<code lang="pas"> | <code lang="pas"> | ||
==== Vectorscript ==== | |||
PROCEDURE Example; | PROCEDURE Example; | ||
VAR | VAR | ||
Line 54: | Line 56: | ||
v1.x := 12; v1.y := 1; { z vals in 3-dimensional vectors will be ignored } | v1.x := 12; v1.y := 1; { z vals in 3-dimensional vectors will be ignored } | ||
v2.x := 12; v2.y := 1; | v2.x := 12; v2.y := 1; | ||
Message(Concat( EqPt(v1, v2, 0) )); | Message(Concat( EqPt(v1, v2, 0.1) )); | ||
END; | END; | ||
Run(Example); | Run(Example); | ||
</code> | </code> | ||
==== Python ==== | |||
<code lang="py"> | <code lang="py"> | ||
v1 = (12, 1, 999) # z vals in 3-dimensional vectors will be ignored | v1 = (12, 1, 999) # z vals in 3-dimensional vectors will be ignored | ||
v2 = (12, 1, 0) | v2 = (12, 1, 0) | ||
vs.Message( str(vs. | vs.Message( str(vs.EqPt(v1, v2, 0.1)) ) # surprisingly returns true in spite of the tuples being different, because the third item will be ignored. | ||
</code> | </code> | ||
Line 68: | Line 71: | ||
----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | ||
<seeAlso></seeAlso> | <seeAlso> | ||
VS Functions: | |||
* [[VS:EqualPt]] | |||
* [[VS:EqPt2D]] | |||
* [[VS:EqPt3D]] | |||
</seeAlso> | |||
----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- |
Revision as of 08:27, 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 EqPt(
pt1 :VECTOR;
pt2 :VECTOR;
tolerance :REAL) : BOOLEAN;
def vs.EqPt(pt1, pt2, tolerance): return BOOLEAN
Parameters
pt1 VECTOR pt2 VECTOR tolerance REAL
Remarks
(_c_, 2022.01.21) In Python, contrary to most Pascal-derived vectorial routines, it accepts also a bidimensional tuple without returning gibberish: the third item will always be ignored. So this is a 2D-only routine.
Example
==== Vectorscript ==== PROCEDURE Example; VAR v1, v2 : VECTOR; BEGIN v1.x := 12; v1.y := 1; { z vals in 3-dimensional vectors will be ignored } 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 vectors will be ignored v2 = (12, 1, 0) vs.Message( str(vs.EqPt(v1, v2, 0.1)) ) # surprisingly returns true in spite of the tuples being different, because the third item will be ignored.
Version
Availability: from Vectorworks 2014
See Also
VS Functions:
VS Functions:
- [[VS:EqualPt]]
- [[VS:EqPt2D]]
- [[VS:EqPt3D]]