24 #include <dtkCoreSupport/dtkGlobal.h>
30 class axlCylinderPrivate
94 this->setParent(other.parent());
97 d->radius = other.
radius();
126 *(d->p1) = *(other.d->p1);
127 *(d->p2) = *(other.d->p2);
128 d->radius = other.
radius();
201 d->p1->coordinates()[0] = p1[0];
202 d->p1->coordinates()[1] = p1[1];
203 d->p1->coordinates()[2] = p1[2];
212 d->p2->coordinates()[0] = p2[0];
213 d->p2->coordinates()[1] = p2[1];
214 d->p2->coordinates()[2] = p2[2];
246 double oldLength = this->
length();
249 (*d->p2) = *(d->p1) + (*(d->p2) - *(d->p1)) * (length/oldLength) ;
253 qDebug()<<
"cylinder is not correctly defined length = 0.0";
258 d->p1->setCoordinates(p1.
x(),p1.
y(),p1.
z());
264 d->p2->setCoordinates(p2.
x(),p2.
y(),p2.
z());
301 QString result =
"axlCylinder";
302 result.append(
"\nfirstPoint : "+d->p1->description() +
"\nsecondPoint : "+d->p2->description() +
"\nradius : "+ QString::number(d->radius));
308 return "axlCylinder";
330 QVariant
id = QVariant::fromValue(
identifier());
331 QVariant
radius = QVariant::fromValue(d->radius);
332 QVariantList p1 = d->p1->convertDataToQVariant();
333 QVariantList p2 = d->p2->convertDataToQVariant();
338 QVariant name = QVariant::fromValue(objectName());
346 p1List.append(data.at(2));
347 p1List.append(data.at(3));
348 p1List.append(data.at(4));
349 p1List.append(data.at(5));
350 p1List.append(data.at(6));
351 d->p1->convertQVariantToData(p1List);
353 p2List.append(data.at(7));
354 p2List.append(data.at(8));
355 p2List.append(data.at(9));
356 p2List.append(data.at(10));
357 p2List.append(data.at(11));
358 d->p2->convertQVariantToData(p2List);
359 setObjectName(data.last().toString());
Class axlPoint defines 3D points.
dtkAbstractData * createaxlCylinder(void)
void setFirstPoint(axlPoint *p1)
Change first point of this cylinder.
void touchFirstPoint(axlPoint p1)
void onFirstPointChanged(axlPoint *p1)
void setRadius(double radius)
Change radius of this cylinder.
QVariantList convertDataToQVariant(void) const
Convert an axlAbstractData into a QVariantList that specifies all properties of the axlAbstractData...
axlPoint * secondPoint(void) const
Returns second point of the cylinder.
Class axlCylinder defines 3D cylinders.
void setSecondPoint(axlPoint *p2)
Change second point of this cylinder.
int convertQVariantToData(const QVariantList &data)
Modify properties and geometry variables of the axlAbstractData. Return 1 if the modification was suc...
void setLength(double length)
Change length of this cylinder we considered then first point is the origin of the cylinder and we ch...
~axlCylinder(void)
Destroys the axel cylinder.
axlPoint * firstPoint(void) const
Returns first point of the cylinder.
void onSecondPointChanged(axlPoint *p2)
void touchSecondPoint(axlPoint p2)
double length(void) const
Returns length of the cylinder.
virtual QString description(void) const
QDebug operator<<(QDebug dbg, axlCylinder cylinder)
axlCylinder(QObject *parent=0)
Constructs a axel cylinder of with firstPoint and second point are NULL and 1.0 radius with parent pa...
void onRadiusChanged(double radius)
void touchRadius(double radius)
static double distance(const axlPoint &lhs, const axlPoint &rhs)
Returns the distance between lhs point and rhs point.
axlCylinder & operator=(const axlCylinder &other)
Assigns other to this cylinder and returns a reference to this cylinder.
double radius(void) const
Returns radius of the cylinder.
void setValues(axlPoint *p1, axlPoint *p2, double radius)
Change first point and second point of this cylinder.
Class axlAbstractData defines an API for all type of axel data.
virtual QString identifier(void) const