use of org.fxyz.geometry.Point3D in project FXyzLib by Birdasaur.
the class BezierHelper method getS.
public Point3D getS(int t, float cu, float su) {
if (ab == null || bc == null || cd == null) {
preProcess();
}
Point3D[] trihedron = trihedrons.get(t);
// S[t,u]
Point3D p = trihedron[BezierHelper.R].add(trihedron[BezierHelper.N].multiply(cu).add(trihedron[BezierHelper.B].multiply(su)));
// [0-1]
p.f = ((float) t / (float) subDivLength);
return p;
}
use of org.fxyz.geometry.Point3D in project FXyzLib by Birdasaur.
the class KnotHelper method getS.
public Point3D getS(int t, float cu, float su) {
Point3D[] trihedron = trihedrons.get(t);
// S[t,u]
Point3D p = trihedron[KnotHelper.tR].add(trihedron[KnotHelper.tN].multiply(cu).add(trihedron[KnotHelper.tB].multiply(su)));
// [0-2Pi]
p.f = ((float) (t * 2d * Math.PI) / (float) subDivLength);
return p;
}
use of org.fxyz.geometry.Point3D in project FXyzLib by Birdasaur.
the class KnotHelper method getTau.
public double getTau(double t) {
// r'[t]
Point3D dR = new Point3D((float) (-(p * (R + r * Math.cos(q * t)) * Math.sin(p * t)) - q * r * Math.cos(p * t) * Math.sin(q * t)), (float) (p * Math.cos(p * t) * (R + r * Math.cos(q * t)) - q * r * Math.sin(p * t) * Math.sin(q * t)), (float) (q * r * Math.cos(q * t)));
// r''[t]
Point3D ddR = new Point3D((float) (-(q * q * r * Math.cos(p * t) * Math.cos(q * t)) - p * p * Math.cos(p * t) * (R + r * Math.cos(q * t)) + 2 * p * q * r * Math.sin(p * t) * Math.sin(q * t)), (float) (-(q * q * r * Math.cos(q * t) * Math.sin(p * t)) - p * p * (R + r * Math.cos(q * t)) * Math.sin(p * t) - 2 * p * q * r * Math.cos(p * t) * Math.sin(q * t)), (float) (-(q * q * r * Math.sin(q * t))));
// r'''[t]
Point3D dddR = new Point3D((float) (p * (p * p * R + (p * p + 3 * q * q) * r * Math.cos(q * t)) * Math.sin(p * t) + q * (3 * p * p + q * q) * r * Math.cos(p * t) * Math.sin(q * t)), (float) (-(p * Math.cos(p * t) * (p * p * R + (p * p + 3 * q * q) * r * Math.cos(q * t))) + q * (3 * p * p + q * q) * r * Math.sin(p * t) * Math.sin(q * t)), (float) (-(q * q * q * r * Math.cos(q * t))));
// r'[t]xr''[t] . r'''[t]
float dRxddRxdddR = dR.crossProduct(ddR).dotProduct(dddR);
// || r''[t]xr'[t] ||
float ndRxddR = dR.crossProduct(ddR).magnitude();
// tau[t] = r'[t]xr''[t].r'''[t] / || r''[t]xr'[t] ||^2
return Math.abs(dRxddRxdddR / (float) Math.pow(ndRxddR, 2d));
}
use of org.fxyz.geometry.Point3D in project FXyzLib by Birdasaur.
the class SpringHelper method getKappa.
public double getKappa(double t) {
// r'[t]
Point3D dR = new Point3D((float) (-R * Math.sin(t)), (float) (R * Math.cos(t)), (float) (h));
// || r'[t] ||
float nT = dR.magnitude();
// r''[t]
Point3D ddR = new Point3D((float) (-R * Math.cos(t)), (float) (-R * Math.sin(t)), (float) (0));
// || r''[t]xr'[t] ||
float nddRxdR = ddR.crossProduct(dR).magnitude();
// kappa[t] = || r''[t]xr'[t] || / || r'[t] ||^3
return nddRxdR / (float) Math.pow(nT, 3d);
}
use of org.fxyz.geometry.Point3D in project FXyzLib by Birdasaur.
the class SpringHelper method getTau.
public double getTau(double t) {
Point3D dR = new Point3D((float) (-R * Math.sin(t)), (float) (R * Math.cos(t)), (float) (h));
// r''[t]
Point3D ddR = new Point3D((float) (-R * Math.cos(t)), (float) (-R * Math.sin(t)), (float) (0));
// r'''[t]
Point3D dddR = new Point3D((float) (R * Math.sin(t)), (float) (-R * Math.cos(t)), (float) (0));
// r'[t]xr''[t] . r'''[t]
float dRxddRxdddR = dR.crossProduct(ddR).dotProduct(dddR);
// || r''[t]xr'[t] ||
float ndRxddR = dR.crossProduct(ddR).magnitude();
// tau[t] = r'[t]xr''[t].r'''[t] / || r''[t]xr'[t] ||^2
return Math.abs(dRxddRxdddR / (float) Math.pow(ndRxddR, 2d));
}
Aggregations