VS:EqPt3D: Difference between revisions
Jump to navigation
Jump to search
m (1 revision) |
(add comment and examples) |
||
(3 intermediate revisions by the same user not shown) | |||
Line 5: | Line 5: | ||
----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | ||
<desc> | <desc> | ||
Returns TRUE if the 3D points are equal within the tolerance. | Returns TRUE if the 3D points are equal within the tolerance.</desc> | ||
</desc> | |||
----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | ||
<def> | <def> | ||
<funcDef lang="vs"> | <funcDef lang="vs"> | ||
FUNCTION EqPt3D( | FUNCTION EqPt3D(pt1:VECTOR; pt2:VECTOR; tolerance:REAL) : BOOLEAN; | ||
</funcDef> | </funcDef> | ||
<funcDef lang="py"> | <funcDef lang="py"> | ||
Line 23: | Line 22: | ||
<lineList ident=1> | <lineList ident=1> | ||
<line> | <line> | ||
pt1 | |||
VECTOR | |||
</line> | </line> | ||
<line> | <line> | ||
pt2 | |||
VECTOR | |||
</line> | </line> | ||
Line 39: | Line 38: | ||
</lineList> | </lineList> | ||
</params> | </params> | ||
----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | ||
<remark> | <remark> | ||
(_c_, 2022.01.22) : | |||
* Python: contrary to most Pascal-derived vectorial routines, it accepts also bidimensional tuples or even a 2/3-dimensional mix | |||
* Python and Pascal: Don't pass 0 to the tolerance, or the routine will always return false. | |||
</remark> | </remark> | ||
Line 53: | Line 49: | ||
<sample> | <sample> | ||
==== Vectorscript ==== | |||
<code lang="pas"> | |||
PROCEDURE Example; | |||
VAR | |||
v1, v2 : VECTOR; | |||
BEGIN | |||
v1.x := 12; v1.y := 1; v1.z := 999; | |||
v2.x := 12; v2.y := 1; v2.z := 999.01; | |||
Message(Concat( EqPt3D(v1, v2, 0.1) )); { returns true } | |||
Message(Concat( EqPt3D(v1, v2, 0.01) )); { returns false } | |||
Message(Concat( EqPt3D(v1, v2, 0) )); { always returns false! Don't use tolerance zero } | |||
END; | |||
Run(Example); | |||
</code> | |||
==== Python ==== | |||
<code lang="py"> | |||
v1 = (12, 1, 999) # also accepts bidimensional tuples | |||
v2 = (12, 1, 999) | |||
vs.Message( str(vs.EqPt3D(v1, v2, 0.01)) ) # returns true | |||
# example with faulty tolerance | |||
v1 = (12, 1, 999) | |||
v2 = (12, 1, 999) | |||
vs.Message( str(vs.EqPt3D(v1, v2, 0)) ) # always returns false! Don't use tolerance zero | |||
</code> | |||
</sample> | </sample> | ||
----------------------------------------------------------------------------------------------------------- | |||
<seeAlso> | |||
VS Functions: | |||
* [[VS:EqualPt]] | |||
* [[VS:EqPt]] | |||
* [[VS:EqPt2D]] | |||
</seeAlso> | |||
----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | ||
<version> | <version> | ||
Availability: from | Availability: from Vectorworks 2014 | ||
</version> | </version> | ||
</vwDoc> | </vwDoc> |
Latest revision as of 04:51, 22 January 2022
.VectorScript|VectorScript ..VS:Function Reference|Function Reference ..VS:Function_Reference_Appendix|Appendix
Description
Returns TRUE if the 3D points are equal within the tolerance.
FUNCTION EqPt3D(
pt1 :VECTOR;
pt2 :VECTOR;
tolerance :REAL) : BOOLEAN;
def vs.EqPt3D(pt1, pt2, tolerance): return BOOLEAN
Parameters
pt1 VECTOR pt2 VECTOR tolerance REAL
Remarks
(_c_, 2022.01.22) :
- Python: contrary to most Pascal-derived vectorial routines, it accepts also bidimensional tuples or even a 2/3-dimensional mix
- Python and Pascal: Don't pass 0 to the tolerance, or the routine will always return false.
Example
Vectorscript
PROCEDURE Example; VAR v1, v2 : VECTOR; BEGIN v1.x := 12; v1.y := 1; v1.z := 999; v2.x := 12; v2.y := 1; v2.z := 999.01; Message(Concat( EqPt3D(v1, v2, 0.1) )); { returns true } Message(Concat( EqPt3D(v1, v2, 0.01) )); { returns false } Message(Concat( EqPt3D(v1, v2, 0) )); { always returns false! Don't use tolerance zero } END; Run(Example);
Python
v1 = (12, 1, 999) # also accepts bidimensional tuples v2 = (12, 1, 999) vs.Message( str(vs.EqPt3D(v1, v2, 0.01)) ) # returns true # example with faulty tolerance v1 = (12, 1, 999) v2 = (12, 1, 999) vs.Message( str(vs.EqPt3D(v1, v2, 0)) ) # always returns false! Don't use tolerance zero
Version
Availability: from Vectorworks 2014
See Also
VS Functions:
VS Functions:
- [[VS:EqualPt]]
- [[VS:EqPt]]
- [[VS:EqPt2D]]