in Range Angle Java 3D - Java javax.media.j3d

Java examples for javax.media.j3d:Transform3D

Description

in Range Angle 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 void main(String[] argv) throws Exception{
        float angle = 2.45678f;
        float range = 2.45678f;
        System.out.println(inRangeAngle(angle,range));
    }/*from ww w. j a  v a  2 s  .  co m*/
    public static float inRangeAngle(float angle, float range) {
        angle += angle < -range ? (range * 2f) : 0;
        angle -= angle > range ? (range * 2f) : 0;
        return angle;
    }
}

Related Tutorials