3Depict
|
A 3D point data class storage. More...
#include <mathfuncs.h>
Public Member Functions | |
Point3D () | |
Constructor. More... | |
Point3D (float x, float y, float z) | |
Constructor with initialising values. More... | |
Point3D (float *v) | |
Point3D (double *v) | |
void | setValue (unsigned int ui, float val) |
Set by value (ith dim 0, 1 2) More... | |
void | setValue (float fX, float fY, float fZ) |
Set all values. More... | |
void | setValueArr (const float *val) |
Set by pointer. More... | |
void | setISOSpherical (float theta, float phi, float r) |
float | getValue (unsigned int ui) const |
Get value of ith dim (0, 1, 2) More... | |
const float * | getValueArr () const |
void | copyValueArr (float *value) const |
get into an array (note array must hold sizeof(float)*3 bytes of valid mem More... | |
void | add (const Point3D &obj) |
Add a point to this, without generating a return value. More... | |
bool | parse (const std::string &str) |
bool | operator== (const Point3D &pt) const |
Equality operator. More... | |
const Point3D & | operator= (const Point3D &pt) |
assignment operator More... | |
const Point3D & | operator+= (const Point3D &pt) |
+= operator More... | |
const Point3D & | operator-= (const Point3D &pt) |
+= operator More... | |
const Point3D | operator+ (float f) const |
const Point3D & | operator*= (const float scale) |
multiplication operator More... | |
const Point3D | operator+ (const Point3D &pt) const |
Addition operator. More... | |
const Point3D | operator* (float scale) const |
elemental multiplication More... | |
const Point3D | operator* (const Point3D &pt) const |
multiplication More... | |
const Point3D | operator/ (float scale) const |
Division. More... | |
const Point3D | operator/ (const Point3D &p) const |
const Point3D | operator- (const Point3D &pt) const |
Subtraction. More... | |
const Point3D | operator- () const |
returns a negative of the existing value More... | |
Point3D | normalise () |
make point unit magnitude, maintaining direction More... | |
float | sqrDist (const Point3D &pt) const |
returns the square of distance another pt More... | |
float | sqrMag () const |
overload for array indexing returns |pt|^2 More... | |
float | mag () const |
void | sqrt () |
Apply float->float transformation. More... | |
void | sphericalAngles (float &theta, float &phi) const |
float | dotProd (const Point3D &pt) const |
Calculate the dot product of this and another pint. More... | |
Point3D | crossProd (const Point3D &pt) const |
Calculate the cross product of this and another point. More... | |
float | angle (const Point3D &pt) const |
Calculate the angle between two position vectors in radiians. More... | |
void | extend (float distance) |
float | operator[] (unsigned int ui) const |
Retrieve by value. More... | |
float & | operator[] (unsigned int ui) |
Retrieve element by referene. More... | |
bool | insideBox (const Point3D &farPoint) const |
Is a given point stored inside a box bounded by orign and this pt? More... | |
bool | insideBox (const Point3D &lowPoint, const Point3D &highPoint) const |
Tests if this point lies inside the rectangular prism. More... | |
void | negate () |
Makes each value negative of old value. More... | |
void | transform3x3 (const float *matrix) |
bool | orthogonalise (const Point3D &p) |
Static Public Member Functions | |
static Point3D | centroid (const Point3D *p, unsigned int n) |
static Point3D | centroid (const std::vector< Point3D > &p) |
Friends | |
std::ostream & | operator<< (std::ostream &stream, const Point3D &) |
Output streaming operator. Users (x,y,z) as format for output. More... | |
A 3D point data class storage.
A 3D point data class contains operator overloads and some basic mathematical functions
|
inline |
Constructor.
Referenced by applyQuaternion(), and rotatePointsToXYPlane().
|
inline |
Constructor with initialising values.
|
inline |
|
inline |
void Point3D::add | ( | const Point3D & | obj | ) |
Add a point to this, without generating a return value.
Referenced by getValueArr().
float Point3D::angle | ( | const Point3D & | pt | ) | const |
Calculate the angle between two position vectors in radiians.
References dotProd(), EQ_TOL, M_PI, and sqrMag().
Referenced by clockwiseAngle(), DrawCylinder::draw(), DrawGLText::draw(), drawCone(), BoxCropEffect::enable(), Mesh::getAttachedComponents(), DrawGLText::getBoundingBox(), AnnotateFilter::refresh(), rotatePointsToXYPlane(), CropHelper::runFilter(), scatterPointsInPolygon(), ProfileFilter::setPropFromBinding(), and sqrt().
References ASSERT.
Referenced by centroid(), DrawQuad::getOrigin(), BoundCube::getPlaneIntersectVertices(), scatterPointsInPolygon(), and sqrt().
References centroid().
void Point3D::copyValueArr | ( | float * | value | ) | const |
get into an array (note array must hold sizeof(float)*3 bytes of valid mem
References ASSERT.
Referenced by getValueArr(), and IonHit::makePosData().
Calculate the cross product of this and another point.
Referenced by Scene::applyDevice(), clockwiseAngle(), TriangleWithVertexNorm::computeACWNormal(), TriangleWithVertexNorm::computeArea(), computeRotationMatrix(), distanceToSegment(), DrawCylinder::draw(), DrawGLText::draw(), drawCone(), BoxCropEffect::enable(), DrawGLText::getBoundingBox(), Mesh::getTriNormal(), Mesh::getVolume(), intersect_RayTriangle(), Camera::move(), CameraLookAt::move(), orthogonalise(), Camera::pivot(), CameraLookAt::pivot(), CameraLookAt::recomputeUpDirection(), rotatePointsToXYPlane(), CropHelper::runFilter(), TriangleWithVertexNorm::safeComputeACWNormal(), AnnotateFilter::setProperty(), CameraLookAt::setProperty(), ProfileFilter::setPropFromBinding(), sqrt(), and CameraLookAt::translate().
float Point3D::dotProd | ( | const Point3D & | pt | ) | const |
Calculate the dot product of this and another pint.
Referenced by angle(), Scene::applyDevice(), clockwiseAngle(), DrawGLText::draw(), BoxCropEffect::enable(), generate1DAxialDistHist(), generate1DAxialDistHistSweep(), generate1DAxialNNHist(), DrawCylinder::getBoundingBox(), Mesh::getVolume(), intersect_RayTriangle(), AnnotateFilter::refresh(), IonClipFilter::setPropFromBinding(), and sqrt().
void Point3D::extend | ( | float | distance | ) |
References ASSERT, normalise(), and sqrMag().
Referenced by sqrt().
|
inline |
Get value of ith dim (0, 1, 2)
Referenced by BoundCube::containsPt(), K3DNode::getAxisVal(), IonHit::getBoundCube(), K3DNode::getLocVal(), and BoundCube::intersects().
|
inline |
References add(), copyValueArr(), mag(), normalise(), operator*(), operator*=(), operator+(), operator+=(), operator-(), operator-=(), operator/(), operator<<, operator=(), operator==(), parse(), sqrDist(), and sqrMag().
Referenced by DrawPoint::draw(), DrawVector::draw(), and drawCone().
bool Point3D::insideBox | ( | const Point3D & | farPoint | ) | const |
Is a given point stored inside a box bounded by orign and this pt?
returns true if this point is located inside (0,0,0) -> Farpoint assuming box shape (non zero edges return false) farPoint must be positive in all dim
Referenced by sqrt().
Tests if this point lies inside the rectangular prism.
Returns true if this point lies inside the box bounded by lowPoint and highPoint
float Point3D::mag | ( | ) | const |
References sqrMag().
Referenced by getValueArr(), normalise(), and scatterPointsInPolygon().
void Point3D::negate | ( | ) |
Makes each value negative of old value.
Referenced by AnnotateFilter::refresh(), and sqrt().
Point3D Point3D::normalise | ( | ) |
make point unit magnitude, maintaining direction
References mag(), and sqrMag().
Referenced by Scene::applyDevice(), TriangleWithVertexNorm::computeACWNormal(), DrawCylinder::draw(), DrawGLText::draw(), drawCone(), BoxCropEffect::enable(), extend(), DrawCylinder::getBoundingBox(), DrawGLText::getBoundingBox(), BoundCube::getPlaneIntersectVertices(), Mesh::getTriNormal(), getValueArr(), intersect_RayTriangle(), CameraLookAt::move(), orthogonalise(), CameraLookAt::pivot(), CameraLookAt::recomputeUpDirection(), CameraLookAt::recomputeViewDirection(), AnnotateFilter::refresh(), rotatePointsToXYPlane(), CropHelper::runFilter(), TriangleWithVertexNorm::safeComputeACWNormal(), DrawCylinder::setLength(), IonClipFilter::setProperty(), AnnotateFilter::setProperty(), ProfileFilter::setProperty(), IonClipFilter::setPropFromBinding(), ProfileFilter::setPropFromBinding(), VoxeliseFilter::setPropFromBinding(), SpatialAnalysisFilter::setPropFromBinding(), DrawGLText::setTextDir(), DrawGLText::setUp(), Camera::setUpDirection(), Camera::setViewDirection(), and VoxeliseFilter::VoxeliseFilter().
const Point3D Point3D::operator* | ( | float | scale | ) | const |
const Point3D & Point3D::operator*= | ( | const float | scale | ) |
const Point3D Point3D::operator+ | ( | float | f | ) | const |
const Point3D Point3D::operator- | ( | ) | const |
returns a negative of the existing value
Referenced by getValueArr().
const Point3D Point3D::operator/ | ( | float | scale | ) | const |
bool Point3D::operator== | ( | const Point3D & | pt | ) | const |
float Point3D::operator[] | ( | unsigned int | ui | ) | const |
float & Point3D::operator[] | ( | unsigned int | ui | ) |
Retrieve element by referene.
References ASSERT.
bool Point3D::orthogonalise | ( | const Point3D & | p | ) |
References crossProd(), normalise(), and sqrMag().
Referenced by AnnotateFilter::readState(), and sqrt().
bool Point3D::parse | ( | const std::string & | str | ) |
References floatSwapBytes(), M_PI, setISOSpherical(), setValueArr(), splitStrsRef(), stream_cast(), and stripWhite().
Referenced by Filter::applyPropertyNow(), Filter::getBaseErrString(), InterpData::getInterpolatedData(), getValueArr(), AnnotateFilter::readState(), AnnotateFilter::setProperty(), ProfileFilter::setProperty(), SpatialAnalysisFilter::setProperty(), CameraLookAt::setProperty(), and validatePoint3D().
void Point3D::setISOSpherical | ( | float | theta, |
float | phi, | ||
float | r | ||
) |
Referenced by generate1DAxialDistHistSweep(), parse(), and setValueArr().
|
inline |
Set by value (ith dim 0, 1 2)
Referenced by countBinnedIons(), BoxCropEffect::enable(), BoundCube::getBounds(), BoundCube::intersects(), DataLoadFilter::monitorNeedsRefresh(), BoundingBoxFilter::numBytesForCache(), TransformFilter::refresh(), and IonHit::setPos().
|
inline |
Set all values.
|
inline |
Set by pointer.
References setISOSpherical().
Referenced by parse(), and IonHit::setHit().
void Point3D::sphericalAngles | ( | float & | theta, |
float & | phi | ||
) | const |
References ASSERT, EQ_TOL, sphericalAngles(), and sqrMag().
Referenced by sphericalAngles(), and sqrt().
float Point3D::sqrDist | ( | const Point3D & | pt | ) | const |
returns the square of distance another pt
Referenced by CameraLookAt::apply(), computeConvexHull(), BoundCube::containedInSphere(), distanceToFacet(), distanceToSegment(), DrawIsoSurface::draw(), CameraLookAt::ensureVisible(), K3DTree::findKNearest(), CameraLookAt::forwardsDolly(), generate1DAxialDistHistSweep(), generateDistHist(), BoundCube::getMaxDistanceToBox(), getValueArr(), BoundCube::intersects(), AnnotateFilter::refresh(), CameraLookAt::repositionAroundTarget(), CropHelper::runFilter(), CameraLookAt::setOrigin(), CameraLookAt::setProperty(), IonClipFilter::setPropFromBinding(), ClusterAnalysisFilter::setPropFromBinding(), SpatialAnalysisFilter::setPropFromBinding(), CameraLookAt::setTarget(), K3DNode::sqrDist(), and CameraLookAt::translate().
float Point3D::sqrMag | ( | ) | const |
overload for array indexing returns |pt|^2
Referenced by angle(), SelectionBinding::applyTransform(), TriangleWithVertexNorm::computeArea(), computeMatrixEntries(), computeRotationMatrix(), distanceToFacet(), distanceToSegment(), DrawVector::draw(), DrawCylinder::draw(), DrawGLText::draw(), drawCone(), BoxCropEffect::enable(), extend(), generate1DAxialDistHist(), generate1DAxialNNHist(), getValueArr(), intersect_RayTriangle(), mag(), normalise(), orthogonalise(), AnnotateFilter::refresh(), CropHelper::runFilter(), TriangleWithVertexNorm::safeComputeACWNormal(), DrawCylinder::setLength(), AnnotateFilter::setProperty(), ProfileFilter::setProperty(), SpatialAnalysisFilter::setProperty(), CameraLookAt::setProperty(), IonClipFilter::setPropFromBinding(), TransformFilter::setPropFromBinding(), ProfileFilter::setPropFromBinding(), SpatialAnalysisFilter::setPropFromBinding(), and sphericalAngles().
|
inline |
Apply float->float transformation.
References angle(), centroid(), crossProd(), dotProd(), extend(), insideBox(), negate(), operator[](), orthogonalise(), sphericalAngles(), and transform3x3().
Referenced by rotatePointsToXYPlane(), and scatterPointsInPolygon().
void Point3D::transform3x3 | ( | const float * | matrix | ) |
|
friend |
Output streaming operator. Users (x,y,z) as format for output.
Referenced by getValueArr().