49 #define OPENMESH_NORMALCONE_C 54 #include "NormalConeT.hh" 73 template <
typename Scalar>
76 : center_normal_(_center_normal), angle_(_angle)
84 template <
typename Scalar>
89 Scalar dotp = (center_normal_ | _norm);
90 return (dotp >= 1.0 ? 0.0 : (dotp <= -1.0 ? M_PI : acos(dotp)))
98 template <
typename 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 Scalar>
120 Scalar dotp = (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);
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
Scalar max_angle(const Vec3 &) const
return max. distance (radians) unit vector to cone (distant side)