21 #include <dtkCoreSupport/dtkGlobal.h>
24 # define M_PI 3.14159265358979323846
28 # define M_PI_2 1.57079632679489661923
35 class axlTorusParametricPrivate {
49 d(new axlTorusParametricPrivate) {
56 d->v =
new axlPoint(*d->torus->direction());
64 d(new axlTorusParametricPrivate) {
69 d->v =
new axlPoint(*d->torus->direction());
79 d(new axlTorusParametricPrivate) {
94 d(new axlTorusParametricPrivate) {
97 this->setParent(other.parent());
99 d->torus =
new axlTorus(other.d->torus);
123 QString result =
"axlTorusParametric";
124 result.append(
"\nTorus : " + d->torus->description()
125 +
"\nv : " + d->v->description()
126 +
"\nr : " + d->r->description()
127 +
"\nw : " + d->w->description());
132 return "axlTorusParametric";
163 *(d->torus) = *(other.d->torus);
164 *(d->v) = *(other.d->v);
165 *(d->r) = *(other.d->r);
166 *(d->w) = *(other.d->w);
172 d->r->coordinates()[0] = r[0];
173 d->r->coordinates()[1] = r[1];
174 d->r->coordinates()[2] = r[2];
182 double r = d->torus->crossSectionRadius();
183 double a = d->torus->ringRadius();
185 return *(d->torus->centerPoint()) + *(d->r)*(a + r*std::cos(u))*std::cos(v)
186 + *(d->w)*(a + r*std::cos(u))*std::sin(v)
191 double r = d->torus->crossSectionRadius();
192 double a = d->torus->ringRadius();
194 axlPoint p(*(d->torus->centerPoint()) + *(d->r)*(a + r*std::cos(u))*std::cos(v)
195 + *(d->w)*(a + r*std::cos(u))*std::sin(v)
202 double r = d->torus->crossSectionRadius();
203 double a = d->torus->ringRadius();
205 axlPoint p(*(d->torus->centerPoint()) + *(d->r)*(a + r*std::cos(u))*std::cos(v)
206 + *(d->w)*(a + r*std::cos(u))*std::sin(v)
215 double a = d->torus->ringRadius();
216 double r = d->torus->crossSectionRadius();
218 axlPoint* o = d->torus->centerPoint();
226 double u = std::asin(OPk/r);
227 if (std::sqrt(std::pow(OPi ,2) + std::pow(OPj ,2)) < a)
232 if (std::abs(OPi) < 0.001)
235 vm = std::atan2(OPj, OPi);
243 *(d->torus) = *torus;
axlTorus * getTorus(void) const
Class axlPoint defines 3D points.
axlPoint * getW(void) const
virtual void parameterOf(const axlPoint &point, double &um, double &vm)
axlTorusParametric(axlAbstractSurfaceParametric *parent=0)
virtual QString description(void) const
axlPoint * getV(void) const
virtual QString identifier(void) const
virtual axlPoint eval(double u, double v)
virtual ~axlTorusParametric(void)
void setTorus(const axlTorus &torus)
static double dotProduct(const axlPoint &lhs, const axlPoint &rhs)
axlPoint * getR(void) const
void onRChanged(axlPoint *r)
static axlPoint crossProduct(const axlPoint &lhs, const axlPoint &rhs)
Returns the cross product between lhs (coords) and rhs (coords).
void setCoordinates(double x, double y, double z)
Change coordinates of this point.
axlTorusParametric & operator=(const axlTorusParametric &other)
void onTorusChanged(axlTorus *torus)