Commit ab370969 authored by Jan Möbius's avatar Jan Möbius
Browse files

Cleanup hannes patch

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@17447 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 73fd76f1
...@@ -34,9 +34,9 @@ ...@@ -34,9 +34,9 @@
/*===========================================================================*\ /*===========================================================================*\
* * * *
* $Revision: 17373 $ * * $Revision$ *
* $Author: moebius $ * * $Author$ *
* $Date: 2013-08-22 17:54:51 +0200 (Thu, 22 Aug 2013) $ * * $Date$ *
* * * *
\*===========================================================================*/ \*===========================================================================*/
...@@ -51,43 +51,63 @@ ...@@ -51,43 +51,63 @@
#include "PolyLineBezierSplineData.hh" #include "PolyLineBezierSplineData.hh"
void PolyLineBezierSplineData::addInterpolatePoint(ACG::Vec3d _pos, ACG::Vec3d _nor) PolyLineBezierSplineData::PolyLineBezierSplineData(int _meshIndex)
: meshIndex_(_meshIndex)
{
}
int PolyLineBezierSplineData::meshIndex()
{
return meshIndex_;
}
void PolyLineBezierSplineData::addInterpolatePoint(ACG::Vec3d _position, ACG::Vec3d _normal)
{ {
InterpolatePoint p; InterpolatePoint p;
p.Pos_ = _pos; p.position = _position;
p.Nor_ = _nor; p.normal = _normal;
Points_.push_back(p);
points_.push_back(p);
} }
bool PolyLineBezierSplineData::finishSpline() bool PolyLineBezierSplineData::finishSpline()
{ {
Handles_.clear(); handles_.clear();
for(unsigned int i = 0; i < Points_.size() - 1; i++) {
const ACG::Vec3d firstPoint = Points_[i].Pos_, sndPoint = Points_[i + 1].Pos_; for(unsigned int i = 0; i < points_.size() - 1; i++) {
const ACG::Vec3d firstPoint = points_[i].position, sndPoint = points_[i + 1].position;
double r = (firstPoint - sndPoint).norm() / 4.0; double r = (firstPoint - sndPoint).norm() / 4.0;
const ACG::Vec3d dir = sndPoint - firstPoint; const ACG::Vec3d dir = sndPoint - firstPoint;
const ACG::Vec3d ort0 = dir % Points_[i].Nor_, ort1 = dir % Points_[i + 1].Nor_; const ACG::Vec3d ort0 = dir % points_[i].normal, ort1 = dir % points_[i + 1].normal;
ACG::Vec3d f0 = ort0 % Points_[i].Nor_, f1 = ort1 % Points_[i + 1].Nor_; ACG::Vec3d f0 = ort0 % points_[i].normal, f1 = ort1 % points_[i + 1].normal;
ACG::Vec3d near = firstPoint - f0.normalize() * r, ACG::Vec3d near = firstPoint - f0.normalize() * r,
far = sndPoint + f1.normalize() * r; far = sndPoint + f1.normalize() * r;
Handles_.push_back(near);
Handles_.push_back(far); handles_.push_back(near);
handles_.push_back(far);
} }
//handles will be degenerate up to now //handles will be degenerate up to now
for(unsigned int i = 1; i < Handles_.size() - 1; i+=2) { for(unsigned int i = 1; i < handles_.size() - 1; i+=2) {
ACG::Vec3d dir = (Handles_[i + 1] - Handles_[i]) / 2.0;
const ACG::Vec3d dir = (handles_[i + 1] - handles_[i]) / 2.0;
InterpolatePoint& p = getInterpolatePoint(i); InterpolatePoint& p = getInterpolatePoint(i);
Handles_[i + 1] = p.Pos_ + dir; handles_[i + 1] = p.position + dir;
Handles_[i] = p.Pos_ - dir; handles_[i] = p.position - dir;
} }
return true; return true;
} }
PolyLineBezierSplineData::InterpolatePoint& PolyLineBezierSplineData::getInterpolatePoint(unsigned int _handleIndex) PolyLineBezierSplineData::InterpolatePoint& PolyLineBezierSplineData::getInterpolatePoint(unsigned int _handleIndex)
{ {
if(!_handleIndex) if(!_handleIndex)
return Points_[0]; return points_[0];
else if(_handleIndex == Handles_.size()) else if(_handleIndex == handles_.size())
return Points_.back(); return points_.back();
else return Points_[(_handleIndex - 1) / 2 + 1]; else return points_[(_handleIndex - 1) / 2 + 1];
} }
...@@ -34,9 +34,9 @@ ...@@ -34,9 +34,9 @@
/*===========================================================================*\ /*===========================================================================*\
* * * *
* $Revision: 17377 $ * * $Revision$ *
* $Author: moebius $ * * $Author$ *
* $Date: 2013-08-23 14:42:04 +0200 (Fri, 23 Aug 2013) $ * * $Date$ *
* * * *
\*===========================================================================*/ \*===========================================================================*/
...@@ -51,42 +51,51 @@ ...@@ -51,42 +51,51 @@
class DLLEXPORT PolyLineBezierSplineData : public PerObjectData class DLLEXPORT PolyLineBezierSplineData : public PerObjectData
{ {
public: public:
struct InterpolatePoint { struct InterpolatePoint {
ACG::Vec3d Pos_; ACG::Vec3d position;
ACG::Vec3d Nor_; ACG::Vec3d normal;
}; };
std::vector<InterpolatePoint> Points_;
std::vector<ACG::Vec3d> Handles_; std::vector<InterpolatePoint> points_;
int MeshIndex_; std::vector<ACG::Vec3d> handles_;
public: public:
/*
* \brief Creates a new PolyLineBezierSplineData object with no points. /** \brief Creates a new PolyLineBezierSplineData object with no points.
*
*/
PolyLineBezierSplineData(int _meshIndex);
/** \brief Return index of the corresponding mesh
*
*/ */
PolyLineBezierSplineData(int _meshIndex) int meshIndex();
: MeshIndex_(_meshIndex)
{
} /** \brief Adds a point to the end of the list and inserts control points.
/*
* \brief Adds a point to the end of the list and inserts control points.
* *
* @param _pos The location(on the mesh) of the new control point. * @param _position The location(on the mesh) of the new control point.
* @param _nor The normal at the location. * @param _normal The normal at the location.
*/ */
void addInterpolatePoint(ACG::Vec3d _pos, ACG::Vec3d _nor); void addInterpolatePoint(ACG::Vec3d _position, ACG::Vec3d _normal);
/* /** \brief If possible calculates handles.
* \brief If possible calculates handles.
* *
* @return True if it was possible to create handles. * @return True if it was possible to create handles.
*/ */
bool finishSpline(); bool finishSpline();
/* /** \brief Retrieves the interpolate point based on the handle.
* \brief Retrieves the interpolate point based on the handle.
* *
* @param _handleIndex The index of the handle. * @param _handleIndex The index of the handle.
*/ */
InterpolatePoint& getInterpolatePoint(unsigned int _handleIndex); InterpolatePoint& getInterpolatePoint(unsigned int _handleIndex);
private:
/// Index of the corresponding mesh
int meshIndex_;
}; };
...@@ -62,11 +62,14 @@ public: ...@@ -62,11 +62,14 @@ public:
ACG::Vec3d circleNormal_; ACG::Vec3d circleNormal_;
ACG::Vec3d circleMainAxis_; ACG::Vec3d circleMainAxis_;
ACG::Vec3d circleSideAxis_; ACG::Vec3d circleSideAxis_;
double circleMainRadius_; double circleMainRadius_;
double circleSideRadius_; double circleSideRadius_;
int circleMeshIndex_; int circleMeshIndex_;
public: public:
PolyLineCircleData(ACG::Vec3d center, ACG::Vec3d normal, ACG::Vec3d mainAxis, ACG::Vec3d sideAxis, double mainR, double sideR, int mesh); PolyLineCircleData(ACG::Vec3d center, ACG::Vec3d normal, ACG::Vec3d mainAxis, ACG::Vec3d sideAxis, double mainR, double sideR, int mesh);
}; };
...@@ -30,28 +30,37 @@ ...@@ -30,28 +30,37 @@
namespace { namespace {
class GlutPrimitiveNode : public ACG::SceneGraph::GlutPrimitiveNode{ class GlutPrimitiveNode : public ACG::SceneGraph::GlutPrimitiveNode {
public: public:
GlutPrimitiveNode(PolyLineObject* L, std::string name, int _index = -1) GlutPrimitiveNode(PolyLineObject* L, std::string name, int _index = -1)
: ACG::SceneGraph::GlutPrimitiveNode(ACG::SceneGraph::GlutPrimitiveNode::SPHERE, L->manipulatorNode(), name) : ACG::SceneGraph::GlutPrimitiveNode(ACG::SceneGraph::GlutPrimitiveNode::SPHERE, L->manipulatorNode(), name)
{ {
index = _index; index = _index;
line = L; line = L;
} }
public: public:
PolyLineObject* line; PolyLineObject* line;
int index; int index;
}; };
class GlutLineNode : public ACG::SceneGraph::LineNode { class GlutLineNode : public ACG::SceneGraph::LineNode {
public: public:
GlutLineNode(PolyLineObject* L, std::string name) GlutLineNode(PolyLineObject* L, std::string name)
: ACG::SceneGraph::LineNode(LineSegmentsMode, L->manipulatorNode(), name) : ACG::SceneGraph::LineNode(LineSegmentsMode, L->manipulatorNode(), name)
{ {
line = L; line = L;
} }
public: public:
PolyLineObject* line; PolyLineObject* line;
}; };
} }
...@@ -1015,21 +1024,29 @@ me_insertCircle(QMouseEvent* _event) ...@@ -1015,21 +1024,29 @@ me_insertCircle(QMouseEvent* _event)
void PolyLinePlugin:: void PolyLinePlugin::
me_insertSpline(QMouseEvent* _event) me_insertSpline(QMouseEvent* _event)
{ {
TriMeshObject* mesh; TriMeshObject* mesh;
TriMesh::FaceHandle fh; TriMesh::FaceHandle fh;
TriMesh::VertexHandle vh; TriMesh::VertexHandle vh;
ACG::Vec3d hit_point; ACG::Vec3d hit_point;
if(!pick_triangle_mesh(_event->pos(), mesh, fh, vh, hit_point)) if(!pick_triangle_mesh(_event->pos(), mesh, fh, vh, hit_point))
return;//can't generate a circle in empty space return;//can't generate a circle in empty space
ACG::Vec3d bbMin( FLT_MAX, FLT_MAX, FLT_MAX); ACG::Vec3d bbMin( FLT_MAX, FLT_MAX, FLT_MAX);
ACG::Vec3d bbMax(-FLT_MAX,-FLT_MAX,-FLT_MAX); ACG::Vec3d bbMax(-FLT_MAX,-FLT_MAX,-FLT_MAX);
mesh->boundingBox(bbMin, bbMax); mesh->boundingBox(bbMin, bbMax);
const ACG::Vec3d sizeBB((bbMax-bbMin)); const ACG::Vec3d sizeBB((bbMax-bbMin));
if(!mesh->mesh()->has_face_normals()) if(!mesh->mesh()->has_face_normals())
mesh->mesh()->request_face_normals(); mesh->mesh()->request_face_normals();
ACG::Vec3d nor = mesh->mesh()->normal(fh); ACG::Vec3d nor = mesh->mesh()->normal(fh);
if(_event->type() == QEvent::MouseButtonPress) { if(_event->type() == QEvent::MouseButtonPress) {
if(createSpline_CurrSelIndex_ == -1) { if(createSpline_CurrSelIndex_ == -1) {
emit addEmptyObject(DATA_POLY_LINE, createSpline_CurrSelIndex_); emit addEmptyObject(DATA_POLY_LINE, createSpline_CurrSelIndex_);
createSpline_LastSelIndex_ = createSpline_CurrSelIndex_; createSpline_LastSelIndex_ = createSpline_CurrSelIndex_;
createCircle_LastSelIndex_ = -1; createCircle_LastSelIndex_ = -1;
...@@ -1053,36 +1070,44 @@ me_insertSpline(QMouseEvent* _event) ...@@ -1053,36 +1070,44 @@ me_insertSpline(QMouseEvent* _event)
ACG::Vec3d insert_Point = hit_point + nor * 0.003 * sizeBB.norm(); ACG::Vec3d insert_Point = hit_point + nor * 0.003 * sizeBB.norm();
PolyLineObject* lineObject = 0; PolyLineObject* lineObject = 0;
if(!PluginFunctions::getObject(createSpline_CurrSelIndex_, lineObject)) if(!PluginFunctions::getObject(createSpline_CurrSelIndex_, lineObject))
return; return;
PolyLineBezierSplineData* splineData = dynamic_cast<PolyLineBezierSplineData*>(lineObject->objectData(BEZSPLINE_DATA)); PolyLineBezierSplineData* splineData = dynamic_cast<PolyLineBezierSplineData*>(lineObject->objectData(BEZSPLINE_DATA));
GlutPrimitiveNode* handle0 = new GlutPrimitiveNode(lineObject, "N_Control", splineData->Points_.size()); GlutPrimitiveNode* handle0 = new GlutPrimitiveNode(lineObject, "N_Control", splineData->points_.size());
handle0->get_primitive(0).color = ACG::Vec4f(0,1,0,1); handle0->get_primitive(0).color = ACG::Vec4f(0,1,0,1);
handle0->set_size(0.005*sizeBB.norm()); handle0->set_size(0.005*sizeBB.norm());
handle0->show(); handle0->show();
handle0->set_position(insert_Point); handle0->set_position(insert_Point);
handle0->drawMode(ACG::SceneGraph::DrawModes::SOLID_FLAT_SHADED); handle0->drawMode(ACG::SceneGraph::DrawModes::SOLID_FLAT_SHADED);
handle0->enablePicking(false); handle0->enablePicking(false);
lineObject->addAdditionalNode(handle0, name(), "control", splineData->Points_.size()); lineObject->addAdditionalNode(handle0, name(), "control", splineData->points_.size());
emit updatedObject(createSpline_CurrSelIndex_, UPDATE_ALL); emit updatedObject(createSpline_CurrSelIndex_, UPDATE_ALL);
splineData->addInterpolatePoint(insert_Point, nor); splineData->addInterpolatePoint(insert_Point, nor);
} }
if(_event->type() == QEvent::MouseButtonDblClick) { if(_event->type() == QEvent::MouseButtonDblClick) {
PolyLineObject* lineObject = 0; PolyLineObject* lineObject = 0;
if(!PluginFunctions::getObject(createSpline_CurrSelIndex_, lineObject)) if(!PluginFunctions::getObject(createSpline_CurrSelIndex_, lineObject))
return; return;
GlutPrimitiveNode* control = 0; GlutPrimitiveNode* control = 0;
PolyLineBezierSplineData* splineData = dynamic_cast<PolyLineBezierSplineData*>(lineObject->objectData(BEZSPLINE_DATA)); PolyLineBezierSplineData* splineData = dynamic_cast<PolyLineBezierSplineData*>(lineObject->objectData(BEZSPLINE_DATA));
for(unsigned int i = 0; i < splineData->Points_.size(); i++) {
for(unsigned int i = 0; i < splineData->points_.size(); i++) {
lineObject->getAdditionalNode(control, name(), "control", i); lineObject->getAdditionalNode(control, name(), "control", i);
control->enablePicking(true); control->enablePicking(true);
} }
if(splineData->finishSpline()) { if(splineData->finishSpline()) {
for(unsigned int i = 0; i < splineData->Handles_.size(); i++) { for(unsigned int i = 0; i < splineData->handles_.size(); i++) {
const PolyLineBezierSplineData::InterpolatePoint& control = splineData->getInterpolatePoint(i); const PolyLineBezierSplineData::InterpolatePoint& control = splineData->getInterpolatePoint(i);
const ACG::Vec3d hndlPos = splineData->Handles_[i], ctrlPos = control.Pos_; const ACG::Vec3d hndlPos = splineData->handles_[i], ctrlPos = control.position;
GlutPrimitiveNode* handle0 = new GlutPrimitiveNode(lineObject, "N_Handle", i); GlutPrimitiveNode* handle0 = new GlutPrimitiveNode(lineObject, "N_Handle", i);
handle0->get_primitive(0).color = ACG::Vec4f(0,0,1,1); handle0->get_primitive(0).color = ACG::Vec4f(0,0,1,1);
...@@ -1152,18 +1177,19 @@ me_move( QMouseEvent* _event ) ...@@ -1152,18 +1177,19 @@ me_move( QMouseEvent* _event )
BaseNode* node = find_node( PluginFunctions::getRootNode(), node_idx ); BaseNode* node = find_node( PluginFunctions::getRootNode(), node_idx );
GlutPrimitiveNode* glutNode = dynamic_cast<GlutPrimitiveNode*>(node); GlutPrimitiveNode* glutNode = dynamic_cast<GlutPrimitiveNode*>(node);
if(glutNode) { if(glutNode) {
PolyLineCircleData* circleData = dynamic_cast<PolyLineCircleData*>(glutNode->line->objectData(CIRCLE_DATA)); PolyLineCircleData* circleData = dynamic_cast<PolyLineCircleData*>(glutNode->line->objectData(CIRCLE_DATA));
PolyLineBezierSplineData* splineData = dynamic_cast<PolyLineBezierSplineData*>(glutNode->line->objectData(BEZSPLINE_DATA)); PolyLineBezierSplineData* splineData = dynamic_cast<PolyLineBezierSplineData*>(glutNode->line->objectData(BEZSPLINE_DATA));
if(circleData) { if(circleData) {
moveCircle_SelNode_ = glutNode; moveCircle_SelNode_ = glutNode;
createCircle_LastSelIndex_ = createCircle_CurrSelIndex_ = glutNode->line->id(); createCircle_LastSelIndex_ = createCircle_CurrSelIndex_ = glutNode->line->id();
} }
if(splineData) { if(splineData) {
moveBezSpline_SelNode_ = glutNode; moveBezSpline_SelNode_ = glutNode;
createSpline_LastSelIndex_ = moveBezSpline_SelIndex_ = glutNode->line->id(); createSpline_LastSelIndex_ = moveBezSpline_SelIndex_ = glutNode->line->id();
moveBezSpline_SelSubIndex_ = glutNode->index; moveBezSpline_SelSubIndex_ = glutNode->index;
} }
} }
BaseObjectData* obj = 0; BaseObjectData* obj = 0;
...@@ -1192,6 +1218,7 @@ me_move( QMouseEvent* _event ) ...@@ -1192,6 +1218,7 @@ me_move( QMouseEvent* _event )
ACG::Vec3d hit_point; ACG::Vec3d hit_point;
if(moveCircle_SelNode_) { if(moveCircle_SelNode_) {
if(PluginFunctions::scenegraphPick(ACG::SceneGraph::PICK_ANYTHING, _event->pos(), node_idx, target_idx, &hit_point) ) { if(PluginFunctions::scenegraphPick(ACG::SceneGraph::PICK_ANYTHING, _event->pos(), node_idx, target_idx, &hit_point) ) {
PolyLineObject* lineObject; PolyLineObject* lineObject;
...@@ -1206,22 +1233,26 @@ me_move( QMouseEvent* _event ) ...@@ -1206,22 +1233,26 @@ me_move( QMouseEvent* _event )
createCircle_getHitInfo(lineData, hit_point, &hit_point, &cr, &onPlane); createCircle_getHitInfo(lineData, hit_point, &hit_point, &cr, &onPlane);
if(!moveCircle_SelNode_->name().compare("N_Center")) { if(!moveCircle_SelNode_->name().compare("N_Center")) {
lineData->circleCenter_ = hit_point; lineData->circleCenter_ = hit_point;
} }
else { else {
ACG::Vec3d axisa = (onPlane - x0).normalize(); ACG::Vec3d axisa = (onPlane - x0).normalize();
if(!moveCircle_SelNode_->name().compare("N_Handle0")) { if(!moveCircle_SelNode_->name().compare("N_Handle0")) {
ACG::Vec3d axisb = (axisa % n).normalize(); ACG::Vec3d axisb = (axisa % n).normalize();
lineData->circleMainRadius_ = cr; lineData->circleMainRadius_ = cr;
if(_event->modifiers() & Qt::ShiftModifier)
lineData->circleSideRadius_ = cr; if(_event->modifiers() & Qt::ShiftModifier)
lineData->circleSideRadius_ = cr;
lineData->circleMainAxis_ = axisa; lineData->circleMainAxis_ = axisa;
lineData->circleSideAxis_ = axisb; lineData->circleSideAxis_ = axisb;
} else { } else {
ACG::Vec3d axisb = (n % axisa).normalize(); ACG::Vec3d axisb = (n % axisa).normalize();
lineData->circleSideRadius_ = cr; lineData->circleSideRadius_ = cr;
if(_event->modifiers() & Qt::ShiftModifier)
lineData->circleMainRadius_ = cr; if(_event->modifiers() & Qt::ShiftModifier)
lineData->circleMainRadius_ = cr;
lineData->circleSideAxis_ = axisa; lineData->circleSideAxis_ = axisa;
lineData->circleMainAxis_ = axisb; lineData->circleMainAxis_ = axisb;
} }
...@@ -1229,8 +1260,8 @@ me_move( QMouseEvent* _event ) ...@@ -1229,8 +1260,8 @@ me_move( QMouseEvent* _event )
updateHandles(lineObject); updateHandles(lineObject);
updatePolyEllipse(lineObject, tool_->sb_CirclePointNum->value()); updatePolyEllipse(lineObject, tool_->sb_CirclePointNum->value());
} }
}
else if(moveBezSpline_SelNode_) { } else if(moveBezSpline_SelNode_) {
if(PluginFunctions::scenegraphPick(ACG::SceneGraph::PICK_ANYTHING, _event->pos(), node_idx, target_idx, &hit_point) ) { if(PluginFunctions::scenegraphPick(ACG::SceneGraph::PICK_ANYTHING, _event->pos(), node_idx, target_idx, &hit_point) ) {
PolyLineObject* lineObject; PolyLineObject* lineObject;
if(!PluginFunctions::getObject(moveBezSpline_SelIndex_, lineObject)) if(!PluginFunctions::getObject(moveBezSpline_SelIndex_, lineObject))
...@@ -1248,23 +1279,23 @@ me_move( QMouseEvent* _event ) ...@@ -1248,23 +1279,23 @@ me_move( QMouseEvent* _event )
int l,b,w,h; int l,b,w,h;
PluginFunctions::viewerProperties(0).glState().get_viewport(l,b,w,h); PluginFunctions::viewerProperties(0).glState().get_viewport(l,b,w,h);
PluginFunctions::viewerProperties(0).glState().viewing_ray(_event->pos().x(), h - 1 - _event->pos().y(), cameraPos, cameraDir); PluginFunctions::viewerProperties(0).glState().viewing_ray(_event->pos().x(), h - 1 - _event->pos().y(), cameraPos, cameraDir);
double t = ((control.Nor_ | control.Pos_) - (control.Nor_ | cameraPos)) / (control.Nor_ | cameraDir); double t = ((control.normal | control.position) - (control.normal | cameraPos)) / (control.normal | cameraDir);
ACG::Vec3d onPlane = cameraPos + t * cameraDir; ACG::Vec3d onPlane = cameraPos + t * cameraDir;
lineData->Handles_[handleIndex] = onPlane; lineData->handles_[handleIndex] = onPlane;
if(handleIndex % 2 == 1 && handleIndex != ((int)lineData->Handles_.size() - 1)) { if(handleIndex % 2 == 1 && handleIndex != ((int)lineData->handles_.size() - 1)) {
double dist = (lineData->Handles_[handleIndex + 1] - control.Pos_).norm(); double dist = (lineData->handles_[handleIndex + 1] - control.position).norm();
if(_event->modifiers() & Qt::ShiftModifier) if(_event->modifiers() & Qt::ShiftModifier)
dist = (onPlane - control.Pos_).norm(); dist = (onPlane - control.position).norm();
ACG::Vec3d dir = -(onPlane - control.Pos_).normalize(); ACG::Vec3d dir = -(onPlane - control.position).normalize();
lineData->Handles_[handleIndex + 1] = control.Pos_ + dir * dist; lineData->handles_[handleIndex + 1] = control.position + dir * dist;
} }
if(handleIndex % 2 == 0 && handleIndex) { if(handleIndex % 2 == 0 && handleIndex) {
double dist = (lineData->Handles_[handleIndex - 1] - control.Pos_).norm(); double dist = (lineData->handles_[handleIndex - 1] - control.position).norm();
if(_event->modifiers() & Qt::ShiftModifier) if(_event->modifiers() & Qt::ShiftModifier)
dist = (onPlane - control.Pos_).norm(); dist = (onPlane - control.position).norm();
ACG::Vec3d dir = -(onPlane - control.Pos_).normalize(); ACG::Vec3d dir = -(onPlane - control.position).normalize();
lineData->Handles_[handleIndex - 1] = control.Pos_ + dir * dist; lineData->handles_[handleIndex - 1] = control.position + dir * dist;
} }
} }
else if(!moveBezSpline_SelNode_->name().compare("N_Control")) { else if(!moveBezSpline_SelNode_->name().compare("N_Control")) {
...@@ -1273,19 +1304,19 @@ me_move( QMouseEvent* _event ) ...@@ -1273,19 +1304,19 @@ me_move( QMouseEvent* _event )
int controlIndex = moveBezSpline_SelSubIndex_; int controlIndex = moveBezSpline_SelSubIndex_;
ACG::Vec3d oldPos = moveBezSpline_SelNode_->get_position(); ACG::Vec3d oldPos = moveBezSpline_SelNode_->get_position();
moveBezSpline_SelNode_->set_position(onMesh); moveBezSpline_SelNode_->set_position(onMesh);
lineData->Points_[controlIndex].Pos_ = onMesh; lineData->points_[controlIndex].position = onMesh;
lineData->Points_[controlIndex].Nor_ = onMeshNor; lineData->points_[