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