is Affine Java 3D - Java javax.media.j3d

Java examples for javax.media.j3d:Transform3D

Description

is Affine Java 3D

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{
    public static boolean isAffine(Transform3D t1) {
        //TODO: one day a fast version of this using the mat
        /*float[] matrix = new float[16];
        t.get(matrix);//from w w  w .  j  a v a2s  .  co m
        boolean hasNAN = false;
        for (int i = 0; i < 16; i++)
           hasNAN = hasNAN || Float.isNaN(matrix[i]);
        boolean byPrim = (matrix[12] == 0 && matrix[13] == 0 && matrix[14] == 0 && matrix[15] == 1);*/
        boolean byMeth = ((t1.getType() & Transform3D.AFFINE) != 0);

        return byMeth;
    }
}

Related Tutorials