84 const scalar radiusSqr
87 return (
centre.distSqr(this->centre(index)) <= radiusSqr);
96 scalar& nearestDistSqr,
101 for (
const label index : indices)
103 const point& pt = centre(index);
105 const scalar distSqr =
sample.distSqr(pt);
107 if (distSqr < nearestDistSqr)
109 nearestDistSqr = distSqr;
131 scalar nearestDistSqr = linePoint.distSqr(nearestPoint);
133 for (
const label index : indices)
135 const point& pt = centre(index);
137 if (tightest.contains(pt))
141 const scalar distSqr =
sqr(pHit.distance());
143 if (distSqr < nearestDistSqr)
145 nearestDistSqr = distSqr;
147 linePoint = pHit.point();
151 tightest.grow(pHit.distance());
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
Minimal example by using system/controlDict.functions:
scalar distance() const noexcept
Return distance to hit.
const point_type & point() const noexcept
Return the point, no checks.
scalar distSqr(const Vector< Cmpt > &v2) const
The L2-norm distance squared from another vector. The magSqr() of the difference.
void grow(const scalar delta)
Expand box by adjusting min/max by specified amount in each dimension.
Non-pointer based hierarchical recursive searching. Storage is dynamic, so elements can be deleted.
Holds (reference to) pointField. Encapsulation of data needed for octree searches....
void findNearest(const labelUList &indices, const point &sample, scalar &nearestDistSqr, label &nearestIndex, point &nearestPoint) const
Calculates nearest (to sample) point in shape.
volumeType getVolumeType(const dynamicIndexedOctree< dynamicTreeDataPoint > &, const point &) const
Get type (inside,outside,mixed,unknown) of point w.r.t. surface.
dynamicTreeDataPoint(const DynamicList< point > &points)
Construct from List. Holds reference!
treeBoundBox bounds(const labelUList &indices) const
Return bounding box for the specified point indices.
const point & centre(label index) const
Point at specified shape index.
const DynamicList< point > & points() const noexcept
The original point field.
bool overlaps(const label index, const treeBoundBox &searchBox) const
Does (bb of) shape at index overlap bb.
Standard boundBox with extra functionality for use in octree.
bool contains(const vector &dir, const point &) const
Contains point (inside or on edge) and moving in direction.
An enumeration wrapper for classification of a location as being inside/outside of a volume.
#define defineTypeName(Type)
Define the typeName.
PointHit< point > pointHit
A PointHit with a 3D point.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
line< point, const point & > linePointRef
A line using referred points.
vector point
Point is a vector.
UList< label > labelUList
A UList of labels.
bool ln(const fileName &src, const fileName &dst)
Create a softlink. dst should not exist. Returns true if successful.