MeVisLabToolboxReference
|
The CSOGeometry namespace offers some common methods for various geometric problems, e.g., determining whether a CSO lies in a plane, if a CSO is self-intersection, computing the center of gravity, thinning out path points or applying Boolean operations. More...
Classes | |
class | PositionObj |
Enumerations | |
enum | ReductionMode { REDUCTION_MODE_ANGLE = 0, REDUCTION_MODE_LENGTH, REDUCTION_MODE_ANGLE_AND_LENGTH } |
Functions | |
MLCSO_EXPORT bool | computeIsInPlane (const CSO *cso, Vector3 &planeNormal) |
Returns whether all the seed points lie in one plane, and fills the plane normal. | |
MLCSO_EXPORT Vector3 | computeNewellsNormal (std::vector< Vector3 > &points) |
Returns a normal for the given list of points using Newell's method. | |
MLCSO_EXPORT bool | isSelfIntersecting (const std::vector< Vector3 > &positions, std::vector< Vector3 > &intersectPoints, bool isClosed) |
Returns whether the given list of points interpreted as a contour intersects itself. | |
MLCSO_EXPORT bool | isSelfIntersecting (const std::vector< Vector3 > &positions, bool isClosed) |
Returns whether the given list of points interpreted as a contour intersects itself. | |
MLCSO_EXPORT bool | isSelfIntersecting (const CSO *cso) |
Returns whether the given contour intersects itself. | |
MLCSO_EXPORT bool | isSelfIntersecting (const CSO *cso, std::vector< Vector3 > &intersectPositions) |
Returns whether the given contour intersects itself. Fills up the given intersectPositions vector. | |
MLCSO_EXPORT double | computeSegmentSegmentDistance (const Vector3 &start0, const Vector3 &end0, const Vector3 &start1, const Vector3 &end1, Vector3 &intersectionPoint, bool &isParallel) |
Returns the minimum distance between the two given segments. If this distance is 0, the intersectionPoint is valid. | |
MLCSO_EXPORT double | computeSegmentSegmentDistance (const Vector3 &start0, const Vector3 &end0, const Vector3 &start1, const Vector3 &end1, Vector3 &intersectionPoint) |
/deprecated | |
MLCSO_EXPORT bool | areInSamePlane (CSO *cso0, CSO *cso1, const MLdouble epsilon=10e-5) |
Returns whether the two given CSOs lie in the same plane. | |
MLCSO_EXPORT void | rotateAndProject (Rotation &rot, Vector3 &voxelPos, bool shouldProject=true) |
Transforms and projects a voxelPos according to a rotation. | |
MLCSO_EXPORT void | level (CSO *cso) |
Determines the normal and the center of gravity of the given CSO. | |
MLCSO_EXPORT void | translate (CSO *cso, const Vector3 &translation) |
Translates a CSO with all its seed- and path points by the given translation vector. | |
MLCSO_EXPORT bool | isPointInsidePolygon (const std::vector< Vector3 > &polygonPoints, const Vector3 &point) |
Returns whether a point is inside the polygon defined by the given list of positions. | |
MLCSO_EXPORT void | appendUniquePosition (std::vector< Vector3 > &positions, Vector3 pos) |
Appends a new point to the given vector without double insertions. | |
MLCSO_EXPORT Vector3 | getCenterOfGravity (CSO *cso, bool considerSeedPointsExtra=false) |
Returns the center of gravity of a given CSO. | |
MLCSO_EXPORT double | distanceToLine (const Vector3 &point, const Vector3 &linePoint1, const Vector3 &linePoint2) |
Computes distance of point to (infinite) line given by two other points: | |
MLCSO_EXPORT double | distanceToLine2 (const Vector3 &linePoint1, const Vector3 &linePoint2, const Vector3 &point, Vector3 &resultPoint) |
Computes the squared distance of point to line segment given by two other points. | |
MLCSO_EXPORT void | computeClosestSeedPoint (CSO *cso, const Vector3 &referencePoint, unsigned int &resultSeedPointIndex) |
Returns the closest point on a cso to the given reference point. | |
MLCSO_EXPORT void | computeClosestPoint (CSO *cso, const Vector3 &referencePoint, unsigned int &resultPathPointListIndex, unsigned int &resultPathPointIndex, Vector3 &resultPosition) |
Returns the closest point on a cso to the given reference point. | |
MLCSO_EXPORT void | computeClosestPoint (const std::vector< Vector3 > &pointList, const Vector3 &referencePoint, unsigned int &resultPointIndex, Vector3 &resultPosition) |
Returns the closest point on the given list of positions. | |
MLCSO_EXPORT double | computeDistance (CSO *cso, const Vector3 &referencePoint) |
Returns the distance of the given point to the given CSO . | |
MLCSO_EXPORT double | computeLength (const CSOPathPointIterator &startIter, const CSOPathPointIterator &endIter) |
Computes the length of a CSO between two PathPointIterators. | |
MLCSO_EXPORT void | thinOutCSO (CSO *cso, float quality=0.5f, ReductionMode reductionMode=REDUCTION_MODE_ANGLE_AND_LENGTH, unsigned int minPoints=5, float maxAngleLimit=1.0) |
Thins out the given cso by removing all positions that do not contribute to the overall geometry (angle and length criterion). | |
MLCSO_EXPORT void | thinOutPointList (std::vector< Vector3 > &positionList, float quality=0.5f, ReductionMode reductionMode=REDUCTION_MODE_ANGLE_AND_LENGTH, unsigned int minPoints=5, float maxAngleLimit=1.0) |
Thins out the given list of positions by removing all positions that do not contribute to the overall geometry (angle and length criterion). | |
MLCSO_EXPORT bool | csoIsEnclosedByCSO (CSO *toTestInnerCSO, CSO *toTestOuterCSO) |
Returns whether the first given CSO lies fully within the second given CSO without crossing. | |
MLCSO_EXPORT size_t | getLevelOfEmbedding (const CSOListPtr &csoList, std::vector< size_t > &result) |
Writes the level of embedding of the CSOs in the given CSOList into the given vector of integers. | |
MLCSO_EXPORT bool | isApproximatelyParallel (const CSO *cso, const Vector3 &normal, double epsilon=0.1) |
Returns whether the given CSO is approximately parallel to a plane given by the normal vector. | |
Variables | |
const unsigned int | INVALID_INDEX = static_cast<unsigned int>(-1) |
A symbolic value that indicates an invalid index (-1). |
The CSOGeometry namespace offers some common methods for various geometric problems, e.g., determining whether a CSO lies in a plane, if a CSO is self-intersection, computing the center of gravity, thinning out path points or applying Boolean operations.
Definition at line 45 of file CSOGeometry.h.
MLCSO_EXPORT void ml::CSOGeometry::appendUniquePosition | ( | std::vector< Vector3 > & | positions, |
Vector3 | pos | ||
) |
Appends a new point to the given vector without double insertions.
MLCSO_EXPORT bool ml::CSOGeometry::areInSamePlane | ( | CSO * | cso0, |
CSO * | cso1, | ||
const MLdouble | epsilon = 10e-5 |
||
) |
Returns whether the two given CSOs lie in the same plane.
MLCSO_EXPORT void ml::CSOGeometry::computeClosestPoint | ( | CSO * | cso, |
const Vector3 & | referencePoint, | ||
unsigned int & | resultPathPointListIndex, | ||
unsigned int & | resultPathPointIndex, | ||
Vector3 & | resultPosition | ||
) |
Returns the closest point on a cso to the given reference point.
MLCSO_EXPORT void ml::CSOGeometry::computeClosestPoint | ( | const std::vector< Vector3 > & | pointList, |
const Vector3 & | referencePoint, | ||
unsigned int & | resultPointIndex, | ||
Vector3 & | resultPosition | ||
) |
Returns the closest point on the given list of positions.
MLCSO_EXPORT void ml::CSOGeometry::computeClosestSeedPoint | ( | CSO * | cso, |
const Vector3 & | referencePoint, | ||
unsigned int & | resultSeedPointIndex | ||
) |
Returns the closest point on a cso to the given reference point.
MLCSO_EXPORT double ml::CSOGeometry::computeDistance | ( | CSO * | cso, |
const Vector3 & | referencePoint | ||
) |
Returns the distance of the given point to the given CSO .
MLCSO_EXPORT bool ml::CSOGeometry::computeIsInPlane | ( | const CSO * | cso, |
Vector3 & | planeNormal | ||
) |
Returns whether all the seed points lie in one plane, and fills the plane normal.
MLCSO_EXPORT double ml::CSOGeometry::computeLength | ( | const CSOPathPointIterator & | startIter, |
const CSOPathPointIterator & | endIter | ||
) |
Computes the length of a CSO between two PathPointIterators.
MLCSO_EXPORT Vector3 ml::CSOGeometry::computeNewellsNormal | ( | std::vector< Vector3 > & | points | ) |
Returns a normal for the given list of points using Newell's method.
MLCSO_EXPORT double ml::CSOGeometry::computeSegmentSegmentDistance | ( | const Vector3 & | start0, |
const Vector3 & | end0, | ||
const Vector3 & | start1, | ||
const Vector3 & | end1, | ||
Vector3 & | intersectionPoint | ||
) |
/deprecated
MLCSO_EXPORT double ml::CSOGeometry::computeSegmentSegmentDistance | ( | const Vector3 & | start0, |
const Vector3 & | end0, | ||
const Vector3 & | start1, | ||
const Vector3 & | end1, | ||
Vector3 & | intersectionPoint, | ||
bool & | isParallel | ||
) |
Returns the minimum distance between the two given segments. If this distance is 0, the intersectionPoint is valid.
MLCSO_EXPORT bool ml::CSOGeometry::csoIsEnclosedByCSO | ( | CSO * | toTestInnerCSO, |
CSO * | toTestOuterCSO | ||
) |
MLCSO_EXPORT double ml::CSOGeometry::distanceToLine | ( | const Vector3 & | point, |
const Vector3 & | linePoint1, | ||
const Vector3 & | linePoint2 | ||
) |
Computes distance of point to (infinite) line given by two other points:
MLCSO_EXPORT double ml::CSOGeometry::distanceToLine2 | ( | const Vector3 & | linePoint1, |
const Vector3 & | linePoint2, | ||
const Vector3 & | point, | ||
Vector3 & | resultPoint | ||
) |
Computes the squared distance of point to line segment given by two other points.
MLCSO_EXPORT Vector3 ml::CSOGeometry::getCenterOfGravity | ( | CSO * | cso, |
bool | considerSeedPointsExtra = false |
||
) |
Returns the center of gravity of a given CSO.
An optional parameter can cause the seed points to be considered for the calculation (default = false), for example, if they are not positioned on the paths themselves.
MLCSO_EXPORT size_t ml::CSOGeometry::getLevelOfEmbedding | ( | const CSOListPtr & | csoList, |
std::vector< size_t > & | result | ||
) |
MLCSO_EXPORT bool ml::CSOGeometry::isApproximatelyParallel | ( | const CSO * | cso, |
const Vector3 & | normal, | ||
double | epsilon = 0.1 |
||
) |
Returns whether the given CSO is approximately parallel to a plane given by the normal vector.
The optional thickness parameter epsilon
is a limit to the thickness of the point cloud of the CSO points in direction of the normal. This method can also be used to determine if a CSO is in-plane with a very small epsilon
value and a normal pointing into the same direction as the assumed CSO's normal.
MLCSO_EXPORT bool ml::CSOGeometry::isPointInsidePolygon | ( | const std::vector< Vector3 > & | polygonPoints, |
const Vector3 & | point | ||
) |
Returns whether a point is inside the polygon defined by the given list of positions.
Make sure that the point and the list of positions lie both in the z-plane (the plane with the z-axis as the normal).
MLCSO_EXPORT bool ml::CSOGeometry::isSelfIntersecting | ( | const CSO * | cso | ) |
Returns whether the given contour intersects itself.
MLCSO_EXPORT bool ml::CSOGeometry::isSelfIntersecting | ( | const std::vector< Vector3 > & | positions, |
bool | isClosed | ||
) |
Returns whether the given list of points interpreted as a contour intersects itself.
MLCSO_EXPORT bool ml::CSOGeometry::isSelfIntersecting | ( | const CSO * | cso, |
std::vector< Vector3 > & | intersectPositions | ||
) |
Returns whether the given contour intersects itself. Fills up the given intersectPositions
vector.
MLCSO_EXPORT bool ml::CSOGeometry::isSelfIntersecting | ( | const std::vector< Vector3 > & | positions, |
std::vector< Vector3 > & | intersectPoints, | ||
bool | isClosed | ||
) |
Returns whether the given list of points interpreted as a contour intersects itself.
Fills up the given intersectPoints
vector.
MLCSO_EXPORT void ml::CSOGeometry::level | ( | CSO * | cso | ) |
Determines the normal and the center of gravity of the given CSO.
Then, all seed points and all path points are projected onto the plane that is defined by the normal and the point (CoG).
MLCSO_EXPORT void ml::CSOGeometry::rotateAndProject | ( | Rotation & | rot, |
Vector3 & | voxelPos, | ||
bool | shouldProject = true |
||
) |
Transforms and projects a voxelPos according to a rotation.
Make sure that the rotation rotates the voxelPos to the z-plane (the plane with the z-axis as a normal).
MLCSO_EXPORT void ml::CSOGeometry::thinOutCSO | ( | CSO * | cso, |
float | quality = 0.5f , |
||
ReductionMode | reductionMode = REDUCTION_MODE_ANGLE_AND_LENGTH , |
||
unsigned int | minPoints = 5 , |
||
float | maxAngleLimit = 1.0 |
||
) |
Thins out the given cso by removing all positions that do not contribute to the overall geometry (angle and length criterion).
This function is a modification of CSOMath::thinOutPathPoints(...).
MLCSO_EXPORT void ml::CSOGeometry::thinOutPointList | ( | std::vector< Vector3 > & | positionList, |
float | quality = 0.5f , |
||
ReductionMode | reductionMode = REDUCTION_MODE_ANGLE_AND_LENGTH , |
||
unsigned int | minPoints = 5 , |
||
float | maxAngleLimit = 1.0 |
||
) |
Thins out the given list of positions by removing all positions that do not contribute to the overall geometry (angle and length criterion).
MLCSO_EXPORT void ml::CSOGeometry::translate | ( | CSO * | cso, |
const Vector3 & | translation | ||
) |
Translates a CSO with all its seed- and path points by the given translation vector.
const unsigned int ml::CSOGeometry::INVALID_INDEX = static_cast<unsigned int>(-1) |
A symbolic value that indicates an invalid index (-1).
Definition at line 144 of file CSOGeometry.h.
Referenced by ml::CSOPathPointConstIterator::isEnd(), and ml::CSOPathPointIterator::isEnd().