59 #include "PolyLinePlugin.hh" 76 return _point + nor * rayInt[0].second;
77 return _point + nor.
normalize() * neigh.dist;
88 for(
unsigned int i = 0; i < splineData->handles_.size(); i++) {
93 _line->
add_line(control.position, splineData->handles_[i]);
96 for(
unsigned int i = 0; i < splineData->points_.size(); i++) {
113 unsigned int segCount = (splineData->points_.size() + splineData->handles_.size() - 1) / 3;
114 for(
unsigned int s = 0; s < segCount; s++) {
115 const ACG::Vec3d a = splineData->points_[s].position, d = splineData->points_[s + 1].position,
116 b = splineData->handles_[s * 2], c = splineData->handles_[s * 2 + 1];
118 unsigned int n = (s != segCount - 1) ? _pointCount : (_pointCount + 1);
119 for(
unsigned int i = 0; i < n; i++) {
120 float alpha = float(i) / float(_pointCount);
121 const ACG::Vec3d e = a + (b - a) * alpha, f = c + (d - c) * alpha;
void updatePolyBezierHandles(PolyLineObject *_lineObject, ACG::SceneGraph::LineNode *_line)
Updates all the handles on the PolyBezier.
void add_point(const Point &_p)
Append a point to the polyline.
RayCollision raycollision(const Point &_p, const Point &_r) const
intersect mesh with ray
QString name()
Name of the Plugin.
NearestNeighbor nearest(const Point &_p) const
Return handle of the nearest neighbor face.
OMTriangleBSP * requestTriangleBsp()
bool getAdditionalNode(NodeT *&_node, QString _pluginName, QString _nodeName, int _id=0)
get an addition node from the object
ACG::Vec3d getPointOnMesh(PolyLineBezierSplineData *_SplineData, ACG::Vec3d _point, ACG::Vec3d *_nor=0)
Returns the nearest point on the mesh or if none could be found the input.
auto normalize() -> decltype(*this/=std::declval< VectorT< S, DIM >>().norm())
PolyLine * line()
return a pointer to the line
MeshT * mesh()
return a pointer to the mesh
bool getObject(const int _identifier, BaseObject *&_object)
Get the object which has the given identifier.
Type for a MeshObject containing a triangle mesh.
void add_line(const Vec3d &_v0, const Vec3d &_v1)
add line (for LineMode == LineSegmentsMode)
const UpdateType UPDATE_GEOMETRY(UpdateTypeSet(1)<< 2)
Geometry updated.
void clear()
Clear the current polyline.
InterpolatePoint & getInterpolatePoint(unsigned int _handleIndex)
Retrieves the interpolate point based on the handle.
size_t meshIndex_
Index of the corresponding mesh.
std::vector< std::pair< Handle, Scalar > > RayCollision
Store nearest neighbor information.
void clear()
clear points/lines and colors
const UpdateType UPDATE_TOPOLOGY(UpdateTypeSet(1)<< 3)
Topology updated.
void updatePolyBezierSpline(PolyLineObject *_lineObject, unsigned int _pointsPerSegment)
Generates points for the spline, updates handles.
void set_position(const Vec3d &_p, int _idx=0)
set position
PerObjectData * objectData(QString _dataName)
Returns the object data pointer.
void add_color(const ACG::Vec3uc &_c)
add color (only for LineMode == LineSegmentsMode)