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);
NormalConeT()
default constructor (not initialized)
Definition: NormalConeT.hh:90
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
Contains all the mesh ingredients like the polygonal mesh, the triangle mesh, different mesh kernels ...
Definition: MeshItems.hh:59
Scalar angle() const
returns size of cone (radius in radians)
Definition: NormalConeT.hh:108
/class NormalCone NormalCone.hh <ACG/Geometry/Types/NormalCone.hh>
Definition: NormalConeT.hh:81