Go to the documentation of this file.
19 #ifndef viskores_Geometry_h
20 #define viskores_Geometry_h
28 template <
typename CoordType,
int Dim,
bool IsTwoS
ided>
30 template <
typename CoordType,
int Dim>
32 template <
typename CoordType>
34 template <
typename CoordType,
int Dim>
42 template <
typename CoordType = viskores::FloatDefault,
int Dim = 3,
bool IsTwoS
ided = false>
53 template <int Dim_ = Dim, typename std::enable_if<Dim_ == 2, int>::type = 0>
57 template <int Dim_ = Dim, typename std::enable_if<Dim_ == 3, int>::type = 0>
112 template <bool OtherTwoSided, int Dim_ = Dim, typename std::enable_if<Dim_ == 2, int>::type = 0>
115 CoordType tol = 0.f);
119 template <
typename CoordType = viskores::FloatDefault,
int Dim = 3>
127 template <int Dim_ = Dim, typename std::enable_if<Dim_ == 2, int>::type = 0>
131 template <int Dim_ = Dim, typename std::enable_if<Dim_ == 3, int>::type = 0>
140 bool IsSingular(CoordType tol2 =
static_cast<CoordType
>(1.0e-6f))
const;
143 template <int Dim_ = Dim, typename std::enable_if<Dim_ == 3, int>::type = 0>
147 template <int Dim_ = Dim, typename std::enable_if<Dim_ == 2, int>::type = 0>
191 template <int Dim_ = Dim, typename std::enable_if<Dim_ == 2, int>::type = 0>
194 CoordType tol = 0.f);
198 template <
typename CoordType = viskores::FloatDefault>
211 Plane(
const Vector& origin,
const Vector& normal, CoordType tol2 =
static_cast<CoordType
>(1e-8f));
215 bool IsValid()
const {
return !viskores::IsInf(this->Normal[0]); }
235 template <
bool IsTwoS
ided>
237 CoordType& parameter,
240 CoordType tol = CoordType(1e-6f))
const;
253 CoordType& parameter,
254 bool& lineInPlane)
const;
267 CoordType& parameter,
269 bool& lineInPlane)
const;
292 CoordType tol2 =
static_cast<CoordType
>(1e-6f))
const;
298 template <
typename CoordType = viskores::FloatDefault,
int Dim = 3>
314 bool IsValid()
const {
return this->Radius > 0.f; }
337 template <
typename CoordType,
int Dim = 3>
341 template <
typename CoordType>
343 template <
typename CoordType>
345 template <
typename CoordType>
347 template <
typename CoordType>
349 template <
typename CoordType>
351 template <
typename CoordType>
355 template <
typename T>
359 template <
typename T>
361 template <
typename T>
390 template <
typename CoordType,
bool IsTwoS
ided>
394 CoordType tol2 =
static_cast<CoordType
>(1e-8f));
396 template <
typename CoordType>
400 CoordType tol2 =
static_cast<CoordType
>(1e-8f));
403 template <
typename CoordType>
408 CoordType tol =
static_cast<CoordType
>(1e-6f));
411 template <
typename CoordType>
417 CoordType tol =
static_cast<CoordType
>(1e-6f));
421 #include <viskores/Geometry.hxx>
423 #endif // viskores_Geometry_h
viskores::Circle< CoordType > make_CircleFrom3Points(const typename viskores::Vec< CoordType, 2 > &p0, const typename viskores::Vec< CoordType, 2 > &p1, const typename viskores::Vec< CoordType, 2 > &p2, CoordType tol=static_cast< CoordType >(1e-6f))
Construct a circle from 3 points.
bool IsValid() const
Return true if the plane's normal is well-defined to within the given tolerance.
Definition: Geometry.h:215
bool IsSingular(CoordType tol2=static_cast< CoordType >(1.0e-6f)) const
Return whether this line segment has an infinitesimal extent (i.e., whether the endpoints are coincid...
Vector Center() const
Return the midpoint of the line segment.
Definition: Geometry.h:152
bool IsValid() const
Return whether the ray is valid or not.
viskores::Vec< CoordType, Dim > Vector
Definition: Geometry.h:302
Plane()
Construct a default plane whose base point is the origin and whose normal is (0,0,...
Vector Evaluate(CoordType param) const
Compute a point along the line. param values in [0,1] lie on the line segment.
viskores::Plane< CoordType > make_PlaneFromPointAndLine(const viskores::Vec< CoordType, 3 > &point, const viskores::Ray< CoordType, 3, IsTwoSided > &ray, CoordType tol2=static_cast< CoordType >(1e-8f))
Construct a plane from a point plus one of: a line, a ray, or a line segment.
bool Intersect(const Ray< CoordType, Dim, OtherTwoSided > &other, Vector &point, CoordType tol=0.f)
Compute the non-degenerate point where two 2-D rays intersect, or return false.
viskores::Sphere< CoordType, 3 > make_SphereFrom4Points(const viskores::Vec< CoordType, 3 > &a0, const viskores::Vec< CoordType, 3 > &a1, const viskores::Vec< CoordType, 3 > &a2, const viskores::Vec< CoordType, 3 > &a3, CoordType tol=static_cast< CoordType >(1e-6f))
Construct a sphere from 4 points.
bool Contains(const Vector &point, CoordType tol2=0.f) const
Return whether the point lies strictly inside the sphere.
Vector Direction() const
Return the vector pointing to endpoint 1 from endpoint 0.
Definition: Geometry.h:159
static constexpr int Dimension
Definition: Geometry.h:122
viskores::Vec< CoordType, 3 > Vector
Definition: Geometry.h:201
#define VISKORES_EXEC_CONT
Definition: ExportMacros.h:60
Sphere()
Construct a default sphere (unit radius at the origin).
CoordType DistanceTo(const Vector &point) const
Return the signed distance from the plane to the point.
bool IntersectInfinite(const LineSegment< CoordType, Dim > &other, Vector &point, CoordType tol=0.f)
Compute the non-degenerate point where two (infinite) 2-D line segments intersect,...
Represent a finite line segment with a pair of points.
Definition: Geometry.h:31
Vector Direction
Definition: Geometry.h:50
Groups connected points that have the same field value.
Definition: Atomic.h:27
static constexpr bool TwoSided
Definition: Geometry.h:47
Vector Endpoints[2]
Definition: Geometry.h:124
CoordType Radius
Definition: Geometry.h:304
Plane< CoordType > PerpendicularBisector() const
Construct a plane bisecting this line segment (only when Dimension is 3).
Vector Evaluate(CoordType param) const
Compute a point along the line. param values > 0 lie on the ray.
LineSegment()
Construct a default segment from (0,0) to (1,0).
bool IsValid() const
Return true if the sphere is valid (i.e., has a strictly positive radius).
Definition: Geometry.h:314
static constexpr int Dimension
Definition: Geometry.h:45
CoordType DistanceTo(const Vector &point) const
Return the minmum distance from point to this line segment.
Represent an infinite or semi-infinite line segment with a point and a direction.
Definition: Geometry.h:29
Vector Origin
Definition: Geometry.h:49
static constexpr int Dimension
Definition: Geometry.h:301
bool Intersect(const Ray< CoordType, 3, IsTwoSided > &ray, CoordType ¶meter, Vector &point, bool &lineInPlane, CoordType tol=CoordType(1e-6f)) const
Intersect this plane with the ray (or line if the ray is two-sided).
Vector Center
Definition: Geometry.h:303
viskores::Vec< CoordType, Dim > Vector
Definition: Geometry.h:123
viskores::Plane< CoordType > make_PlaneFromPointAndLineSegment(const viskores::Vec< CoordType, 3 > &point, const viskores::LineSegment3< CoordType > &segment, CoordType tol2=static_cast< CoordType >(1e-8f))
Vector Origin
Definition: Geometry.h:202
Ray()
Construct a default 2-D ray, from (0,0) pointing along the +x axis.
Vector ClosestPoint(const Vector &point) const
Return the closest point in the plane to the given point.
int Classify(const Vector &point, CoordType tol2=0.f) const
Classify a point as inside (-1), on (0), or outside (+1) of the sphere.
CoordType DistanceTo(const Vector &point) const
Return the minmum distance from point to this line/ray.
Vector Normal
Definition: Geometry.h:203
Represent a plane with a base point (origin) and normal vector.
Definition: Geometry.h:33
Represent a sphere of the given Dimension.
Definition: Geometry.h:35