The 3D ACIS® Modeler (ACIS) is Spatial’s prominent 3D solid modeling engine. 3D InterOp is a CAD data translation framework (Interoperability)

HowTo:Determine if two points are the same?

From DocR19

Jump to: navigation, search

Call the function same_point in position.hxx. Alternatively use the overloaded operators == or != (The latter internally call same_point with SPAresabs)

Contents

Signature

// Tolerance aware
logical same_point(SPAposition const&p1, SPAposition const&p2, const double res = SPAresabs);
 
// Simple 3D point comparison.
logical operator==(SPAposition const &p1, SPAposition const &p2);
logical operator!=(SPAposition const &p1, SPAposition const &p2);

Header Files

#include "position.hxx"

Example

SPAposition pos1 = ed1->start_pos();
SPAposition pos2 = ed1->start_pos();
if ( pos1 == pos2 )
   cout << "simple test, not tolerance aware!" << endl;
 
double pos1_tol = ed1->start()->get_curr_tolerance(); // Retrieve real vertex tolerance.
double pos2_tol = ed2->start()->get_curr_tolerance(); 
double work_tol = pos1_tol + pos2_tol; // OR pos1_tol > pos2_tol ? pos1_tol : pos2_tol. Whatever tol you are after!
 
if ( same_point( pos1, pos2, work_tol ) )
   cout << "3D test with tolerance awareness" << endl;

Scheme Commands

; There is no direct Scheme interface:
(define p1 (position 2 0 0))
(define p2 (position 2 0 0))
(test:less-than 1e-6 (position:distance p1 p2) "p1 and p2 are the same")
;*** Error: p1 and p2 are the same       0.000001 !< 0.000000
;#f

Notes

  • Note that tolerance plays an important role in 3D point comparison.

Related Content

See also: :Category:FAQs
Personal tools