雪山飞狐_lzh 发表于 2010-4-18 11:26:00

Tolerance容差类在点或向量比较时的应用示例

复制代码运行结果复制代码

雪山飞狐_lzh 发表于 2010-4-18 11:27:00

点或向量在比较时,应用到了容差类的两个数值,实际使用时不需要重写这方面的方法
只需设置容差,然后直接判断就OK了
帮助文档中的相关内容
This is an instantiable class that is by default initialized to the default tolerances. Subsequently, the tolerances within it can be customized to suit a specific need. For example, an instance of this class may be specialized for use during surface intersection.
Class Tolerance keeps two properties, EqualPoint and EqualVector, which are used in evaluation according to the following rules:
Two points, p1 and p2, are equal if

       
(p1 - p2).length()
Two vectors, v1 and v2, are equal if
(v1 - v2).length()
Two vectors, v1 and v2, are parallel if
(v1/v1.length() - v2/v2.length() ).length() OR
(v1/v1.length() + v2/v2.length() ).length()
Two vectors, v1 and v2, are perpendicular if
abs((v1.dotProduct(v2))/(v1.length()*v2.length()))
Two lines or rays are parallel (perpendicular) if their directional vectors are parallel (perpendicular)

游天居士 发表于 2010-4-18 14:53:00

收到

yxr_MJTD 发表于 2010-12-25 10:18:00

Point3d pt1 = new Point3d(0, 0.0001, 0);
            Point3d pt2 = new Point3d(0, 0, 0);
            ed.WriteMessage(
                "\nEqualPoint:{0}\nEqualVector:{1}",
                Tolerance.Global.EqualPoint,
                Tolerance.Global.EqualVector);
这一句话还不是很明白, Tolerance.Global.EqualPoint,Tolerance.Global.EqualVector 的作用最不清楚。

chpmould 发表于 2010-12-25 10:58:00

谢谢!!学习了...

sieben 发表于 2010-12-25 11:55:00

原来有个Tolerance.Global并可写的,之前不知道,学习了,谢谢斑竹!
页: [1]
查看完整版本: Tolerance容差类在点或向量比较时的应用示例