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
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.
Vector Direction() const
Return the vector pointing to endpoint 1 from endpoint 0.
Definition: Geometry.h:151
LineSegment()
Construct a default segment from (0,0) to (1,0).
Vector ClosestPoint(const Vector &point) const
Return the closest point in the plane to the given point.
Plane()
Construct a default plane whose base point is the origin and whose normal is (0,0,...
static constexpr int Dimension
Definition: Geometry.h:37
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.
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
vtkm::Plane< CoordType > make_PlaneFromPointAndLineSegment(const vtkm::Vec< CoordType, 3 > &point, const vtkm::LineSegment3< CoordType > &segment, CoordType tol2=static_cast< CoordType >(1e-8f))
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.
#define VTKM_EXEC_CONT
Definition: ExportMacros.h:52
Vector Origin
Definition: Geometry.h:41
Plane< CoordType > PerpendicularBisector() const
Construct a plane bisecting this line segment (only when Dimension is 3).
bool IsValid() const
Return whether the ray is valid or not.
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...
CoordType Radius
Definition: Geometry.h:296
static constexpr int Dimension
Definition: Geometry.h:293
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.
vtkm::Vec< CoordType, Dim > Vector
Definition: Geometry.h:115
bool IsValid() const
Return true if the sphere is valid (i.e., has a strictly positive radius).
Definition: Geometry.h:306
Vector Center() const
Return the midpoint of the line segment.
Definition: Geometry.h:144
Vector Evaluate(CoordType param) const
Compute a point along the line. param values > 0 lie on the ray.
bool IsValid() const
Return true if the plane's normal is well-defined to within the given tolerance.
Definition: Geometry.h:207
bool Contains(const Vector &point, CoordType tol2=0.f) const
Return whether the point lies strictly inside the sphere.
vtkm::Vec< CoordType, Dim > Vector
Definition: Geometry.h:294
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 Normal
Definition: Geometry.h:195
Sphere()
Construct a default sphere (unit radius at the origin).
Represent a finite line segment with a pair of points.
Definition: Geometry.h:23
CoordType DistanceTo(const Vector &point) const
Return the signed distance from the plane to the point.
Represent a sphere of the given Dimension.
Definition: Geometry.h:27
CoordType DistanceTo(const Vector &point) const
Return the minmum distance from point to this line segment.
vtkm::Vec< CoordType, 3 > Vector
Definition: Geometry.h:193
Vector Direction
Definition: Geometry.h:42
Ray()
Construct a default 2-D ray, from (0,0) pointing along the +x axis.
CoordType DistanceTo(const Vector &point) const
Return the minmum distance from point to this line/ray.
Vector Center
Definition: Geometry.h:295
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,...
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
Vector Evaluate(CoordType param) const
Compute a point along the line. param values in [0,1] lie on the line segment.
int Classify(const Vector &point, CoordType tol2=0.f) const
Classify a point as inside (-1), on (0), or outside (+1) of the sphere.