24 #include <dtkCoreSupport/dtkGlobal.h>
26 #include <dtkMathSupport/dtkQuaternion.h>
32 class axlEllipsoidPrivate
56 d->semiX =
new axlPoint(1.0, 0.0, 0.0);
57 d->semiY =
new axlPoint(0.0, 1.0, 0.0);
58 d->semiZ =
new axlPoint(0.0, 0.0, 1.0);
100 this->setParent(other.parent());
102 d->center =
new axlPoint(other.d->center);
103 d->semiX =
new axlPoint(other.d->semiX);
104 d->semiY =
new axlPoint(other.d->semiY);
105 d->semiZ =
new axlPoint(other.d->semiZ);
145 *(d->center) = *(other.d->center);
146 *(d->semiX) = *(other.d->semiX);
147 *(d->semiY) = *(other.d->semiY);
148 *(d->semiZ) = *(other.d->semiZ);
195 *(d->center) = *center;
196 *(d->semiX) = *semiX;
197 *(d->semiY) = *semiY;
198 *(d->semiZ) = *semiZ;
209 *(d->center) = *center;
220 *(d->semiX) = *semiX;
231 *(d->semiY) = *semiY;
242 *(d->semiZ) = *semiZ;
249 d->center->setCoordinates(center.
x(),center.
y(),center.
z());
255 d->semiX->setCoordinates(semiX.
x(),semiX.
y(),semiX.
z());
261 d->semiY->setCoordinates(semiY.
x(),semiY.
y(),semiY.
z());
267 d->semiZ->setCoordinates(semiZ.
x(),semiZ.
y(),semiZ.
z());
298 QString result =
"axlEllipsoid";
300 result.append(
"\ncenter : "+d->center->description()
301 +
"\nsemi axes X value : "+d->semiX->description()
302 +
"\nsemi axes Y value : "+d->semiY->description()
303 +
"\nsemi axes Z value : "+d->semiZ->description());
310 return "axlEllipsoid";
316 *(d->center) = *center;
322 *(d->semiX) = *semiX;
328 *(d->semiY) = *semiY;
334 *(d->semiZ) = *semiZ;
344 d->center->setCoordinates(center[0], center[1], center[2]);
354 d->center->coordinates()[0] = x;
364 d->center->coordinates()[1] = y;
374 d->center->coordinates()[2] = z;
384 d->semiX->setCoordinates(semiX[0], semiX[1], semiX[2]);
394 d->semiX->coordinates()[0] = x;
404 d->semiX->coordinates()[1] = y;
414 d->semiX->coordinates()[2] = z;
424 d->semiY->setCoordinates(semiY[0], semiY[1], semiY[2]);
434 d->semiY->coordinates()[0] = x;
445 d->semiY->coordinates()[1] = y;
455 d->semiY->coordinates()[2] = z;
465 d->semiZ->setCoordinates(semiZ[0], semiZ[1], semiZ[2]);
475 d->semiZ->coordinates()[0] = x;
486 d->semiZ->coordinates()[1] = y;
497 d->semiZ->coordinates()[2] = z;
504 axlPoint semix(d->semiX->coordinates());
509 axlPoint semiy(d->semiY->coordinates());
510 double semiyRadius = semiy.
norm();
514 axlPoint semiz(d->semiZ->coordinates());
515 double semizRadius = semiz.
norm();
519 if (semix.norm() < 0.001) {
521 if (pv.
norm() < 0.001) {
531 if (pv.
norm() < 0.001) {
533 if (pv.
norm() < 0.001) {
550 semiy *= semiyRadius;
552 semiz *= semizRadius;
558 axlPoint semix(d->semiX->coordinates());
559 double semixRadius = semix.
norm();
563 axlPoint semiy(d->semiY->coordinates());
568 axlPoint semiz(d->semiZ->coordinates());
569 double semizRadius = semiz.
norm();
573 if (semiy.norm() < 0.001) {
575 if (pv.
norm() < 0.001) {
585 if (pv.
norm() < 0.001) {
587 if (pv.
norm() < 0.001) {
603 semix *= semixRadius;
606 semiz *= semizRadius;
612 axlPoint semix(d->semiX->coordinates());
613 double semixRadius = semix.
norm();
617 axlPoint semiy(d->semiY->coordinates());
618 double semiyRadius = semiy.
norm();
622 axlPoint semiz(d->semiZ->coordinates());
627 if (semiz.norm() < 0.001) {
629 if (pv.
norm() < 0.001) {
639 if (pv.
norm() < 0.001) {
641 if (pv.
norm() < 0.001) {
657 semix *= semixRadius;
659 semiy *= semiyRadius;
667 QVariant
id = QVariant::fromValue(
identifier());
668 QVariantList
center = d->center->convertDataToQVariant();
669 QVariantList
semiX = d->semiX->convertDataToQVariant();
670 QVariantList
semiY = d->semiY->convertDataToQVariant();
671 QVariantList
semiZ = d->semiZ->convertDataToQVariant();
677 QVariant name = QVariant::fromValue(objectName());
685 center.append(data.at(1));
686 center.append(data.at(2));
687 center.append(data.at(3));
688 center.append(data.at(4));
689 center.append(data.at(5));
690 d->center->convertQVariantToData(center);
692 semiX.append(data.at(6));
693 semiX.append(data.at(7));
694 semiX.append(data.at(8));
695 semiX.append(data.at(9));
696 semiX.append(data.at(10));
697 d->semiX->convertQVariantToData(semiX);
699 semiY.append(data.at(11));
700 semiY.append(data.at(12));
701 semiY.append(data.at(13));
702 semiY.append(data.at(14));
703 semiY.append(data.at(15));
704 d->semiY->convertQVariantToData(semiY);
706 semiZ.append(data.at(16));
707 semiZ.append(data.at(17));
708 semiZ.append(data.at(18));
709 semiZ.append(data.at(19));
710 semiZ.append(data.at(20));
711 d->semiZ->convertQVariantToData(semiZ);
712 setObjectName(data.last().toString());
Class axlPoint defines 3D points.
void onSemiYChanged(axlPoint *semiY)
void setSemiZ(axlPoint *semiZ)
Change semi axes z value of this ellipsoid.
void modifyCenter(double *center)
modify Center of this Ellipsoid.
axlEllipsoid(QObject *parent=0)
Constructs a axel ellipsoid of with firstPoint and second point are NULL and 1.0 radius with parent p...
void modifySemiXZ(double z)
modify Z SemiX value of this Ellipsoid.
void modifySemiYY(double y)
modify Y SemiY value of this Ellipsoid.
void onCenterChanged(axlPoint *center)
void modifySemiYX(double x)
modify X SemiY value of this Ellipsoid.
void touchCenter(axlPoint center)
virtual QString identifier(void) const
void setValues(axlPoint *center, axlPoint *semiX, axlPoint *semiY, axlPoint *semiZ)
Change center, semi axes x, y, z values and quarternion of this ellipsoid.
void modifySemiXX(double x)
modify X SemiX value of this Ellipsoid.
axlPoint * semiX(void) const
Returns semi x axe value of the ellipsoid.
void setCenter(axlPoint *center)
Change center of this ellipsoid.
void touchSemiZ(axlPoint semiZ)
axlPoint * semiY(void) const
Returns semi y axe value of the ellipsoid.
void modifySemiX(double *semiX)
modify SemiX of this Ellipsoid.
axlEllipsoid & operator=(const axlEllipsoid &other)
Assigns other to this ellipsoid and returns a reference to this ellipsoid.
axlPoint * semiZ(void) const
Returns semi z axe value of the ellipsoid.
void modifyCenterZ(double z)
modify Z Center value of this Ellipsoid.
void modifySemiY(double *semiY)
modify SemiY of this Ellipsoid.
void onSemiXChanged(axlPoint *semiX)
void modifySemiZX(double x)
modify X SemiZ value of this Ellipsoid.
void modifySemiZZ(double z)
modify Z SemiZ value of this Ellipsoid.
void modifyCenterY(double y)
modify Y Center value of this Ellipsoid.
void modifySemiYZ(double z)
modify Z SemiY value of this Ellipsoid.
void modifySemiXY(double y)
modify Y SemiX value of this Ellipsoid.
void setSemiX(axlPoint *semiX)
Change semi axes x value of this ellipsoid.
dtkAbstractData * createaxlEllipsoid(void)
void modifyCenterX(double x)
modify X Center value of this Ellipsoid.
void modifySemiZY(double y)
modify Y SemiZ value of this Ellipsoid.
axlPoint * center(void) const
Returns center of the ellipsoid.
QVariantList convertDataToQVariant(void) const
Convert an axlAbstractData into a QVariantList that specifies all properties of the axlAbstractData...
void touchSemiY(axlPoint semiY)
~axlEllipsoid(void)
Destroys the axel ellipsoid.
void touchSemiX(axlPoint semiX)
void modifySemiZ(double *semiZ)
modify SemiZ of this Ellipsoid.
QDebug operator<<(QDebug dbg, axlEllipsoid ellipsoid)
static axlPoint crossProduct(const axlPoint &lhs, const axlPoint &rhs)
Returns the cross product between lhs (coords) and rhs (coords).
virtual QString description(void) const
Class axlEllipsoid defines 3D ellipsoids.
void onSemiZChanged(axlPoint *semiZ)
Class axlAbstractData defines an API for all type of axel data.
int convertQVariantToData(const QVariantList &data)
Modify properties and geometry variables of the axlAbstractData. Return 1 if the modification was suc...
void setSemiY(axlPoint *semiY)
Change semi axes y value of this ellipsoid.