get Java 3D Vector From Node - Java javax.vecmath

Java examples for javax.vecmath:Vector3f

Description

get Java 3D Vector From Node

Demo Code


import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Enumeration;
import javax.media.j3d.Appearance;
import javax.media.j3d.BoundingSphere;
import javax.media.j3d.BranchGroup;
import javax.media.j3d.Material;
import javax.media.j3d.Node;
import javax.media.j3d.PolygonAttributes;
import javax.media.j3d.Shape3D;
import javax.media.j3d.Transform3D;
import javax.media.j3d.TransformGroup;
import javax.vecmath.Color3f;
import javax.vecmath.Point3d;
import javax.vecmath.Point3f;
import javax.vecmath.Quat4f;
import javax.vecmath.Vector3f;

public class Main{
    private static Transform3D t = new Transform3D();
    private static Vector3f v = new Vector3f();
    public static synchronized Vector3f getVectorFromNode(Node node) {
        return new Vector3f(getPointFromNode(node));
    }//from ww  w .  java 2  s  .c  o  m
    public static synchronized Point3f getPointFromNode(Node node) {
        node.getLocalToVworld(t);
        t.get(v);
        return new Point3f(v);
    }
}

Related Tutorials