Search in sources :

Example 41 with Point3D

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;
}
Also used : Point3D(org.fxyz.geometry.Point3D)

Example 42 with Point3D

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;
}
Also used : Point3D(org.fxyz.geometry.Point3D)

Example 43 with Point3D

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));
}
Also used : Point3D(org.fxyz.geometry.Point3D)

Example 44 with Point3D

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);
}
Also used : Point3D(org.fxyz.geometry.Point3D)

Example 45 with Point3D

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));
}
Also used : Point3D(org.fxyz.geometry.Point3D)

Aggregations

Point3D (org.fxyz.geometry.Point3D)48 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)16 List (java.util.List)12 Face3 (org.fxyz.geometry.Face3)12 Collectors (java.util.stream.Collectors)10 IntStream (java.util.stream.IntStream)10 Group (javafx.scene.Group)10 Translate (javafx.scene.transform.Translate)10 ArrayList (java.util.ArrayList)9 Point2D (javafx.geometry.Point2D)9 PerspectiveCamera (javafx.scene.PerspectiveCamera)9 Scene (javafx.scene.Scene)9 KeyCode (javafx.scene.input.KeyCode)9 TriangleMesh (javafx.scene.shape.TriangleMesh)9 Rotate (javafx.scene.transform.Rotate)9 PointLight (javafx.scene.PointLight)8 MouseEvent (javafx.scene.input.MouseEvent)8 DoubleProperty (javafx.beans.property.DoubleProperty)7 IntegerProperty (javafx.beans.property.IntegerProperty)7 SimpleDoubleProperty (javafx.beans.property.SimpleDoubleProperty)7