Go to the documentation of this file.
11 #ifndef vtk_m_Geometry_h
12 #define vtk_m_Geometry_h
20 template <
typename CoordType,
int Dim,
bool IsTwoS
ided>
22 template <
typename CoordType,
int Dim>
24 template <
typename CoordType>
26 template <
typename CoordType,
int Dim>
34 template <
typename CoordType = vtkm::FloatDefault,
int Dim = 3,
bool IsTwoS
ided = false>
45 template <int Dim_ = Dim, typename std::enable_if<Dim_ == 2, int>::type = 0>
49 template <int Dim_ = Dim, typename std::enable_if<Dim_ == 3, int>::type = 0>
104 template <bool OtherTwoSided, int Dim_ = Dim, typename std::enable_if<Dim_ == 2, int>::type = 0>
107 CoordType tol = 0.f);
111 template <
typename CoordType = vtkm::FloatDefault,
int Dim = 3>
119 template <int Dim_ = Dim, typename std::enable_if<Dim_ == 2, int>::type = 0>
123 template <int Dim_ = Dim, typename std::enable_if<Dim_ == 3, int>::type = 0>
132 bool IsSingular(CoordType tol2 =
static_cast<CoordType
>(1.0e-6f))
const;
135 template <int Dim_ = Dim, typename std::enable_if<Dim_ == 3, int>::type = 0>
139 template <int Dim_ = Dim, typename std::enable_if<Dim_ == 2, int>::type = 0>
183 template <int Dim_ = Dim, typename std::enable_if<Dim_ == 2, int>::type = 0>
186 CoordType tol = 0.f);
190 template <
typename CoordType = vtkm::FloatDefault>
203 Plane(
const Vector& origin,
const Vector& normal, CoordType tol2 =
static_cast<CoordType
>(1e-8f));
207 bool IsValid()
const {
return !vtkm::IsInf(this->Normal[0]); }
227 template <
bool IsTwoS
ided>
229 CoordType& parameter,
232 CoordType tol = CoordType(1e-6f))
const;
245 CoordType& parameter,
246 bool& lineInPlane)
const;
259 CoordType& parameter,
261 bool& lineInPlane)
const;
284 CoordType tol2 =
static_cast<CoordType
>(1e-6f))
const;
290 template <
typename CoordType = vtkm::FloatDefault,
int Dim = 3>
306 bool IsValid()
const {
return this->Radius > 0.f; }
329 template <
typename CoordType,
int Dim = 3>
333 template <
typename CoordType>
335 template <
typename CoordType>
337 template <
typename CoordType>
339 template <
typename CoordType>
341 template <
typename CoordType>
343 template <
typename CoordType>
347 template <
typename T>
351 template <
typename T>
353 template <
typename T>
382 template <
typename CoordType,
bool IsTwoS
ided>
386 CoordType tol2 =
static_cast<CoordType
>(1e-8f));
388 template <
typename CoordType>
392 CoordType tol2 =
static_cast<CoordType
>(1e-8f));
395 template <
typename CoordType>
400 CoordType tol =
static_cast<CoordType
>(1e-6f));
403 template <
typename CoordType>
409 CoordType tol =
static_cast<CoordType
>(1e-6f));
413 #include <vtkm/Geometry.hxx>
415 #endif // vtk_m_Geometry_h
Represent an infinite or semi-infinite line segment with a point and a direction.
Definition: Geometry.h:21
VTKM_EXEC_CONT Sphere()
Construct a default sphere (unit radius at the origin).
VTKM_EXEC_CONT CoordType DistanceTo(const Vector &point) const
Return the minmum distance from point to this line/ray.
VTKM_EXEC_CONT Vector Evaluate(CoordType param) const
Compute a point along the line. param values in [0,1] lie on the line segment.
static constexpr int Dimension
Definition: Geometry.h:37
static constexpr bool TwoSided
Definition: Geometry.h:39
Groups connected points that have the same field value.
Definition: Atomic.h:19
static constexpr int Dimension
Definition: Geometry.h:114
#define VTKM_EXEC_CONT
Definition: ExportMacros.h:52
Vector Origin
Definition: Geometry.h:41
VTKM_EXEC_CONT Plane< CoordType > PerpendicularBisector() const
Construct a plane bisecting this line segment (only when Dimension is 3).
VTKM_EXEC_CONT vtkm::Sphere< CoordType, 3 > make_SphereFrom4Points(const vtkm::Vec< CoordType, 3 > &a0, const vtkm::Vec< CoordType, 3 > &a1, const vtkm::Vec< CoordType, 3 > &a2, const vtkm::Vec< CoordType, 3 > &a3, CoordType tol=static_cast< CoordType >(1e-6f))
Construct a sphere from 4 points.
CoordType Radius
Definition: Geometry.h:296
VTKM_EXEC_CONT LineSegment()
Construct a default segment from (0,0) to (1,0).
static constexpr int Dimension
Definition: Geometry.h:293
vtkm::Vec< CoordType, Dim > Vector
Definition: Geometry.h:115
VTKM_EXEC_CONT bool IsValid() const
Return true if the sphere is valid (i.e., has a strictly positive radius).
Definition: Geometry.h:306
VTKM_EXEC_CONT CoordType DistanceTo(const Vector &point) const
Return the minmum distance from point to this line segment.
VTKM_EXEC_CONT vtkm::Plane< CoordType > make_PlaneFromPointAndLineSegment(const vtkm::Vec< CoordType, 3 > &point, const vtkm::LineSegment3< CoordType > &segment, CoordType tol2=static_cast< CoordType >(1e-8f))
VTKM_EXEC_CONT Vector Center() const
Return the midpoint of the line segment.
Definition: Geometry.h:144
VTKM_EXEC_CONT 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).
vtkm::Vec< CoordType, Dim > Vector
Definition: Geometry.h:294
VTKM_EXEC_CONT bool IsValid() const
Return true if the plane's normal is well-defined to within the given tolerance.
Definition: Geometry.h:207
VTKM_EXEC_CONT Vector Evaluate(CoordType param) const
Compute a point along the line. param values > 0 lie on the ray.
VTKM_EXEC_CONT Plane()
Construct a default plane whose base point is the origin and whose normal is (0,0,...
VTKM_EXEC_CONT bool Contains(const Vector &point, CoordType tol2=0.f) const
Return whether the point lies strictly inside the sphere.
VTKM_EXEC_CONT bool IsValid() const
Return whether the ray is valid or not.
Vector Normal
Definition: Geometry.h:195
Represent a finite line segment with a pair of points.
Definition: Geometry.h:23
VTKM_EXEC_CONT Ray()
Construct a default 2-D ray, from (0,0) pointing along the +x axis.
VTKM_EXEC_CONT 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.
VTKM_EXEC_CONT Vector Direction() const
Return the vector pointing to endpoint 1 from endpoint 0.
Definition: Geometry.h:151
Represent a sphere of the given Dimension.
Definition: Geometry.h:27
VTKM_EXEC_CONT 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...
vtkm::Vec< CoordType, 3 > Vector
Definition: Geometry.h:193
VTKM_EXEC_CONT vtkm::Plane< CoordType > make_PlaneFromPointAndLine(const vtkm::Vec< CoordType, 3 > &point, const vtkm::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.
VTKM_EXEC_CONT CoordType DistanceTo(const Vector &point) const
Return the signed distance from the plane to the point.
VTKM_EXEC_CONT Vector ClosestPoint(const Vector &point) const
Return the closest point in the plane to the given point.
Vector Direction
Definition: Geometry.h:42
Vector Center
Definition: Geometry.h:295
VTKM_EXEC_CONT int Classify(const Vector &point, CoordType tol2=0.f) const
Classify a point as inside (-1), on (0), or outside (+1) of the sphere.
VTKM_EXEC_CONT vtkm::Circle< CoordType > make_CircleFrom3Points(const typename vtkm::Vec< CoordType, 2 > &p0, const typename vtkm::Vec< CoordType, 2 > &p1, const typename vtkm::Vec< CoordType, 2 > &p2, CoordType tol=static_cast< CoordType >(1e-6f))
Construct a circle from 3 points.
Vector Origin
Definition: Geometry.h:194
Represent a plane with a base point (origin) and normal vector.
Definition: Geometry.h:25
Vector Endpoints[2]
Definition: Geometry.h:116
VTKM_EXEC_CONT 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,...