59 #define OPENMESH_NORMALCONE_C
64 #include "NormalConeT.hh"
83 template <
typename Scalar>
86 : center_normal_(_center_normal), angle_(_angle)
94 template <
typename Scalar>
99 Scalar dotp = (center_normal_ | _norm);
100 return (dotp >= 1.0 ? 0.0 : (dotp <= -1.0 ? M_PI : acos(dotp)))
108 template <
typename Scalar>
113 Scalar dotp = (center_normal_ | _cone.center_normal_);
114 Scalar centerAngle = dotp >= 1.0 ? 0.0 : (dotp <= -1.0 ? M_PI : acos(dotp));
115 Scalar sideAngle0 = std::max(angle_-centerAngle, _cone.angle_);
116 Scalar sideAngle1 = std::max(_cone.angle_-centerAngle, angle_);
118 return centerAngle + sideAngle0 + sideAngle1;
125 template <
typename Scalar>
130 Scalar dotp = (center_normal_ | _cone.center_normal_);
132 if (fabs(dotp) < 0.99999f)
135 Scalar centerAngle = acos(dotp);
136 Scalar minAngle = std::min(-
angle(), centerAngle - _cone.
angle());
137 Scalar maxAngle = std::max(
angle(), centerAngle + _cone.
angle());
138 angle_ = (maxAngle - minAngle) * Scalar(0.5f);
141 Scalar axisAngle = Scalar(0.5f) * (minAngle + maxAngle);
142 center_normal_ = ((center_normal_ * sin(centerAngle-axisAngle)
143 + _cone.center_normal_ * sin(axisAngle))
150 angle_ = std::max(angle_, _cone.angle_);
154 angle_ = Scalar(2.0f * M_PI);
Scalar max_angle(const Vec3 &) const
return max. distance (radians) unit vector to cone (distant side)
Scalar angle() const
returns size of cone (radius in radians)
NormalConeT()
default constructor (not initialized)
void merge(const NormalConeT &)
merge _cone; this instance will then enclose both former cones
T angle(T _cos_angle, T _sin_angle)