49 #define OPENMESH_NORMALCONE_C
54 #include "NormalConeT.hh"
73 template <
typename Vector>
75 NormalConeT(
const Vec3& _center_normal, Scalar _angle)
76 : center_normal_(_center_normal), angle_(_angle)
84 template <
typename Vector>
85 typename NormalConeT<Vector>::Scalar
89 Scalar dotp = (center_normal_ | _norm);
90 return (dotp >= 1.0 ? 0.0 : (dotp <= -1.0 ? M_PI : acos(dotp)))
98 template <
typename Vector>
99 typename NormalConeT<Vector>::Scalar
103 Scalar dotp = (center_normal_ | _cone.center_normal_);
104 Scalar centerAngle = dotp >= 1.0 ? 0.0 : (dotp <= -1.0 ? M_PI : acos(dotp));
105 Scalar sideAngle0 = std::max(angle_-centerAngle, _cone.angle_);
106 Scalar sideAngle1 = std::max(_cone.angle_-centerAngle, angle_);
108 return centerAngle + sideAngle0 + sideAngle1;
115 template <
typename Vector>
120 Scalar dotp =
dot(center_normal_, _cone.center_normal_);
122 if (fabs(dotp) < 0.99999f)
125 Scalar centerAngle = acos(dotp);
126 Scalar minAngle = std::min(-
angle(), centerAngle - _cone.
angle());
127 Scalar maxAngle = std::max(
angle(), centerAngle + _cone.
angle());
128 angle_ = (maxAngle - minAngle) * Scalar(0.5f);
131 Scalar axisAngle = Scalar(0.5f) * (minAngle + maxAngle);
132 center_normal_ = ((center_normal_ * sin(centerAngle-axisAngle)
133 + _cone.center_normal_ * sin(axisAngle))
140 angle_ = std::max(angle_, _cone.angle_);
144 angle_ = Scalar(2.0f * M_PI);
Contains all the mesh ingredients like the polygonal mesh, the triangle mesh, different mesh kernels ...
Definition: MeshItems.hh:59
osg::Vec3f::ValueType dot(const osg::Vec3f &_v1, const osg::Vec3f &_v2)
Adapter for osg vector member computing a scalar product.
Definition: VectorAdapter.hh:176
T angle(T _cos_angle, T _sin_angle)
returns the angle determined by its cos and the sign of its sin result is positive if the angle is in...
Definition: MathDefs.hh:140
/class NormalCone NormalCone.hh <OpenMesh/Core/Geometry/NormalConeT.hh>
Definition: NormalConeT.hh:78
void merge(const NormalConeT &)
merge _cone; this instance will then enclose both former cones
Definition: NormalConeT_impl.hh:118
Scalar max_angle(const Vec3 &) const
return max. distance (radians) unit vector to cone (distant side)
Definition: NormalConeT_impl.hh:87
Scalar angle() const
returns size of cone (radius in radians)
Definition: NormalConeT.hh:105
NormalConeT()
default constructor (not initialized)
Definition: NormalConeT.hh:87