9 #include "imstkDataArray.h" 10 #include "imstkImageData.h" 11 #include "imstkImplicitGeometry.h" 50 if (coord[0] < m_imageDataSdf->getDimensions()[0] && coord[0] > 0
51 && coord[1] < m_imageDataSdf->getDimensions()[1] && coord[1] > 0
52 && coord[2] < m_imageDataSdf->getDimensions()[2] && coord[2] > 0)
54 return (*m_scalars)[m_imageDataSdf->getScalarIndex(coord)] * m_scale;
58 return std::numeric_limits<double>::min();
80 std::shared_ptr<ImageData>
getImage()
const {
return m_imageDataSdf; }
88 std::unique_ptr<SignedDistanceField>
clone()
90 return std::unique_ptr<SignedDistanceField>(cloneImplementation());
94 std::shared_ptr<ImageData> m_imageDataSdf;
101 std::shared_ptr<DataArray<double>> m_scalars;
108 geom->m_imageDataSdf = m_imageDataSdf->clone();
109 geom->m_scalars = std::dynamic_pointer_cast<
DataArray<double>>(geom->m_imageDataSdf->getScalars());
const Vec6d & getBounds() const
Returns the bounds of the field.
SignedDistanceField(std::shared_ptr< ImageData > imageData)
Constructor.
std::unique_ptr< SignedDistanceField > clone()
Polymorphic clone, hides the declaration in superclass return own type.
void scale(const Vec3d &scaling, TransformType type=TransformType::ConcatenateToTransform)
Scale in Cartesian directions.
double getFunctionValueCoord(const Vec3i &coord) const
Returns signed distance to surface at coordinate inlined for performance.
void setScale(const double scale)
Set the isotropic scale that is used/multplied with samples.
double getScale() const
Get the isotropic scale.
void computeBoundingBox(Vec3d &min, Vec3d &max, const double paddingPercent) override
Compute the bounding box for the geometry.
Structured field of signed distances implemented with ImageData The SDF differs in that when you scal...
std::shared_ptr< ImageData > getImage() const
Get the SDF as a float image.
Class that can represent the geometry of multiple implicit geometries as boolean functions One may su...
double getFunctionValue(const Vec3d &pos) const
Returns signed distance to surface at pos, returns clamped/nearest if out of bounds.