本文整理汇总了C++中Tol类的典型用法代码示例。如果您正苦于以下问题:C++ Tol类的具体用法?C++ Tol怎么用?C++ Tol使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Tol类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mgIsBetweenLine2
// 判断点pt是否在线段ab上
GEOMAPI bool mgIsBetweenLine2(
const Point2d& a, const Point2d& b, const Point2d& pt, const Tol& tol)
{
if (!mgIsColinear2(a, b, pt, tol))
return false;
// If ab not vertical, check betweenness on x; else on y.
if (a.x != b.x)
{
return ((a.x <= pt.x + tol.equalPoint())
&& (pt.x <= b.x + tol.equalPoint()))
|| ((a.x >= pt.x - tol.equalPoint())
&& (pt.x >= b.x - tol.equalPoint()));
}
else
{
return ((a.y <= pt.y + tol.equalPoint())
&& (pt.y <= b.y + tol.equalPoint()))
|| ((a.y >= pt.y - tol.equalPoint())
&& (pt.y >= b.y - tol.equalPoint()));
}
}
示例2: fabsf
bool mglnrel::isColinear2(
const Point2d& a, const Point2d& b, const Point2d& pt, const Tol& tol)
{
float dist = (b-a).crossProduct(pt-a);
return fabsf(dist) < tol.equalPoint();
}
示例3:
bool mglnrel::isLeftOn2(
const Point2d& a, const Point2d& b, const Point2d& pt, const Tol& tol)
{
float dist = (b-a).distanceToVector(pt-a);
return dist > -tol.equalPoint();
}
示例4: main
int
main(int argc, char ** argv)
{
Tol t { argc, argv };
return t.Run();
}
示例5: dotProduct
// 判断两个矢量是否平行
bool Vector2d::isParallelTo(const Vector2d& vec, const Tol& tol) const
{
float cosfz = dotProduct(vec);
float sinfz = crossProduct(vec);
return (fabsf(sinfz) <= fabsf(cosfz) * tol.equalVector());
}
示例6: mgHypot
bool Matrix2d::isEqualTo(const Matrix2d& mat, const Tol& tol) const
{
return mgHypot(m11 - mat.m11, m12 - mat.m12) <= tol.equalVector()
&& mgHypot(m21 - mat.m21, m22 - mat.m22) <= tol.equalVector()
&& mgHypot(dx - mat.dx, dy - mat.dy) <= tol.equalVector();
}
示例7: mgIsLeft2
// 判断点pt是否在有向直线a->b的左边
GEOMAPI bool mgIsLeft2(
const Point2d& a, const Point2d& b, const Point2d& pt, const Tol& tol)
{
float dist = (b-a).distanceToVector(pt-a);
return dist > tol.equalPoint();
}