#include <PrimitiveEvaluator.h>

Classes | |
| struct | Description |
| class | Result |
Public Types | |
| typedef PrimitiveEvaluatorPtr(* | CreatorFn )(ConstPrimitivePtr) |
Public Member Functions | |
| IE_CORE_DECLARERUNTIMETYPED (PrimitiveEvaluator, RunTimeTyped) | |
| IE_CORE_DECLAREPTR (Result) | |
| virtual | ~PrimitiveEvaluator () |
| virtual ResultPtr | createResult () const =0 |
| Create a result instance which is suitable for passing to one of the query methods. | |
| virtual ConstPrimitivePtr | primitive () const =0 |
| Returns the primitive which we're currently evaluating. | |
| virtual void | validateResult (const ResultPtr &result) const =0 |
Query Functions | |
The ResultPtr passed to each of the methods below must previously have been created by a call to the createResult() method on the same evaluator instance as is being called - passing any other result will cause undefined behaviour.
| |
| virtual bool | signedDistance (const Imath::V3f &p, float &distance) const |
| virtual float | surfaceArea () const =0 |
| Computes the surface area of the primitive. | |
| virtual float | volume () const =0 |
| Computes the volume of the primitive. The result is undefined if the primitive is not closed, or self intersects. | |
| virtual Imath::V3f | centerOfGravity () const =0 |
| Computes the primitive's center of gravity. The result is undefined if the primitive is not closed, or self intersects. | |
| virtual bool | closestPoint (const Imath::V3f &p, const ResultPtr &result) const =0 |
| virtual bool | pointAtUV (const Imath::V2f &uv, const ResultPtr &result) const =0 |
| virtual bool | intersectionPoint (const Imath::V3f &origin, const Imath::V3f &direction, const ResultPtr &result, float maxDistance=Imath::limits< float >::max()) const =0 |
| virtual int | intersectionPoints (const Imath::V3f &origin, const Imath::V3f &direction, std::vector< ResultPtr > &results, float maxDistance=Imath::limits< float >::max()) const =0 |
Static Public Member Functions | |
| static PrimitiveEvaluatorPtr | create (ConstPrimitivePtr primitive) |
| typedef PrimitiveEvaluatorPtr( * IECore::PrimitiveEvaluator::CreatorFn)(ConstPrimitivePtr) |
| PrimitiveEvaluator::~PrimitiveEvaluator | ( | ) | [virtual] |
| virtual Imath::V3f IECore::PrimitiveEvaluator::centerOfGravity | ( | ) | const [pure virtual] |
Computes the primitive's center of gravity. The result is undefined if the primitive is not closed, or self intersects.
Implemented in IECore::CurvesPrimitiveEvaluator, IECore::ImagePrimitiveEvaluator, IECore::MeshPrimitiveEvaluator, IECore::PointsPrimitiveEvaluator, and IECore::SpherePrimitiveEvaluator.
| virtual bool IECore::PrimitiveEvaluator::closestPoint | ( | const Imath::V3f & | p, | |
| const ResultPtr & | result | |||
| ) | const [pure virtual] |
Find the closest point on the primitive to the given query point. Returns true on success.
: use a raw pointer rather than a reference to a smart pointer
Referenced by signedDistance().
| PrimitiveEvaluatorPtr PrimitiveEvaluator::create | ( | ConstPrimitivePtr | primitive | ) | [static] |
Returns a primitive evaluator which is compatible with the given primitive, from those evaluator types which have been registered.
Reimplemented in IECore::CurvesPrimitiveEvaluator, IECore::ImagePrimitiveEvaluator, IECore::MeshPrimitiveEvaluator, IECore::PointsPrimitiveEvaluator, and IECore::SpherePrimitiveEvaluator.
| virtual ResultPtr IECore::PrimitiveEvaluator::createResult | ( | ) | const [pure virtual] |
Create a result instance which is suitable for passing to one of the query methods.
Implemented in IECore::CurvesPrimitiveEvaluator, IECore::ImagePrimitiveEvaluator, IECore::MeshPrimitiveEvaluator, IECore::PointsPrimitiveEvaluator, and IECore::SpherePrimitiveEvaluator.
Referenced by signedDistance().
| IECore::PrimitiveEvaluator::IE_CORE_DECLAREPTR | ( | Result | ) |
Reimplemented in IECore::SpherePrimitiveEvaluator.
| IECore::PrimitiveEvaluator::IE_CORE_DECLARERUNTIMETYPED | ( | PrimitiveEvaluator | , | |
| RunTimeTyped | ||||
| ) |
| virtual bool IECore::PrimitiveEvaluator::intersectionPoint | ( | const Imath::V3f & | origin, | |
| const Imath::V3f & | direction, | |||
| const ResultPtr & | result, | |||
| float | maxDistance = Imath::limits< float >::max() | |||
| ) | const [pure virtual] |
Finds the closest intersection point for the given ray. Optionally specify a maximum distance of interest. Returns true if an intersection was found.
| virtual int IECore::PrimitiveEvaluator::intersectionPoints | ( | const Imath::V3f & | origin, | |
| const Imath::V3f & | direction, | |||
| std::vector< ResultPtr > & | results, | |||
| float | maxDistance = Imath::limits< float >::max() | |||
| ) | const [pure virtual] |
Finds all intersection points for the given ray. Optionally specify a maximum distance of interest. Returns the number of interections found.
| virtual bool IECore::PrimitiveEvaluator::pointAtUV | ( | const Imath::V2f & | uv, | |
| const ResultPtr & | result | |||
| ) | const [pure virtual] |
Find the point on the primitive at the given query UV. Returns true on success
| virtual ConstPrimitivePtr IECore::PrimitiveEvaluator::primitive | ( | ) | const [pure virtual] |
Returns the primitive which we're currently evaluating.
Implemented in IECore::CurvesPrimitiveEvaluator, IECore::ImagePrimitiveEvaluator, IECore::MeshPrimitiveEvaluator, IECore::PointsPrimitiveEvaluator, and IECore::SpherePrimitiveEvaluator.
| bool PrimitiveEvaluator::signedDistance | ( | const Imath::V3f & | p, | |
| float & | distance | |||
| ) | const [virtual] |
Computes the signed distance between the given point and the primitive. By default this is just the signed distance between the point, and the plane specified by the closest point and normal, but derived class are free to override it as they see fit. Returns true on success.
Reimplemented in IECore::MeshPrimitiveEvaluator.
References closestPoint(), createResult(), and IECore::sign().
| virtual float IECore::PrimitiveEvaluator::surfaceArea | ( | ) | const [pure virtual] |
Computes the surface area of the primitive.
Implemented in IECore::CurvesPrimitiveEvaluator, IECore::ImagePrimitiveEvaluator, IECore::MeshPrimitiveEvaluator, IECore::PointsPrimitiveEvaluator, and IECore::SpherePrimitiveEvaluator.
| virtual void IECore::PrimitiveEvaluator::validateResult | ( | const ResultPtr & | result | ) | const [pure virtual] |
Throws an exception if the passed result type is not compatible with the current evaluator
| virtual float IECore::PrimitiveEvaluator::volume | ( | ) | const [pure virtual] |
Computes the volume of the primitive. The result is undefined if the primitive is not closed, or self intersects.
Implemented in IECore::CurvesPrimitiveEvaluator, IECore::ImagePrimitiveEvaluator, IECore::MeshPrimitiveEvaluator, IECore::PointsPrimitiveEvaluator, and IECore::SpherePrimitiveEvaluator.
1.5.8