57#include "PolyLinePlugin.hh"
66 x(_circleData->circleMainAxis_),
67 y(_circleData->circleNormal_),
68 z(_circleData->circleSideAxis_)
75 x[0] * v[0] + y[0] * v[1] + z[0] * v[2],
76 x[1] * v[0] + y[1] * v[1] + z[1] * v[2],
77 x[2] * v[0] + y[2] * v[1] + z[2] * v[2]);
94 double smDist = 10e10;
96 for (
unsigned int j = 0; j < rayInt.
size(); j++) {
97 ACG::Vec3d p = _pOnPlane + _n * rayInt[j].second, dir = _center - p;
98 const double dist = dir.
norm();
114 ACG::Vec3d n = _circleData->circleNormal_, x0 = _circleData->circleCenter_;
115 double t = ((n | x0) - (n | _hit_Point)) / n.
sqrnorm();
116 ACG::Vec3d onPlane = _hit_Point + t * n, d = onPlane - x0;
120 *_onPlaneO = onPlane;
148 const double theta = 2.0 * M_PI / double(_pointCount);
150 const double r2 = lineData->circleMainRadius_, r1 = lineData->circleSideRadius_;
151 const Onb basis(lineData);
156 for (
unsigned int i = 0; i <= _pointCount; i++) {
157 const double tanTheta_i = tan(theta * i);
158 double x = (r1 * r2) / sqrt(r2 * r2 + r1 * r1 * tanTheta_i * tanTheta_i);
159 x = ((theta * i) <= M_PI_2 || (theta * i) > (3.0 * M_PI_2)) ? x : -x;
160 const double y = tanTheta_i * x;
163 pInWorld = basis.toWorld(pOnPlane) + lineData->circleCenter_;
164 if(moveCircle_IsFloating)
void set_closed(const bool _c)
Set if the polyline should be closed and therefore forms a loop.
void clear()
Clear the current polyline.
void add_point(const Point &_p)
Append a point to the polyline.
std::vector< std::pair< Handle, Scalar > > RayCollision
Store nearest neighbor information.
RayCollision raycollision(const Point &_p, const Point &_r) const
intersect mesh with ray
PerObjectData * objectData(QString _dataName)
Returns the object data pointer.
OMTriangleBSP * requestTriangleBsp()
decltype(std::declval< S >() *std::declval< S >()) sqrnorm() const
compute squared euclidean norm
auto norm() const -> decltype(std::sqrt(std::declval< VectorT< S, DIM > >().sqrnorm()))
compute euclidean norm
PolyLine * line()
return a pointer to the line
bool createCircle_getPointOnMesh(TriMeshObject *_triMeshObject, ACG::Vec3d _center, ACG::Vec3d _pOnPlane, ACG::Vec3d _n, ACG::Vec3d *_pOut)
Calculates a point on the mesh.
ACG::Vec3d createCircle_getHit(PolyLineCircleData *_circleData, ACG::Vec3d _hit_point)
Returns point on mesh or point on the normal plane.
PolyLineToolbarWidget * tool_
Widget for Toolbox.
bool createCircle_getHitInfo(PolyLineCircleData *_circleData, ACG::Vec3d _hit_Point, ACG::Vec3d *_pOut=0, double *_r=0, ACG::Vec3d *_onPlane=0)
Calculates common info.
void updatePolyEllipse(PolyLineObject *_lineObject, unsigned int _pointCount)
Generates points for the ellipse.
Type for a MeshObject containing a triangle mesh.
const UpdateType UPDATE_TOPOLOGY(UpdateTypeSet(8))
Topology updated.
const UpdateType UPDATE_GEOMETRY(UpdateTypeSet(4))
Geometry updated.
VectorT< double, 3 > Vec3d
bool getObject(const int _identifier, BaseObject *&_object)
Get the object which has the given identifier.