Package org.nlogo.api

Examples of org.nlogo.api.Matrix3D


      }

      if (!myTies.isEmpty()) {
        // create a matrix transform for translating the location
        // of leaf turtles
        Matrix3D htrans = new Matrix3D();
        Matrix3D ptrans = new Matrix3D();
        Matrix3D rtrans = new Matrix3D();
        double dh = Turtle.subtractHeadings(newHeading, oldHeading);
        double dp = Turtle.subtractHeadings(newPitch, oldPitch);
        double dr = Turtle.subtractHeadings(newRoll, oldRoll);


        htrans.zrot(-dh); // this transform method takes degrees, not radians
        Vect[] vects = Vect.toVectors(newHeading, oldPitch, 0);
        ptrans.vrot(0, 0, 0,
            vects[1].x(), vects[1].y(), vects[1].z(), StrictMath.toRadians(dp));
        vects = Vect.toVectors(newHeading, newPitch, oldRoll);
        rtrans.vrot(0, 0, 0,
            vects[0].x(), vects[0].y(), vects[0].z(), StrictMath.toRadians(dr));


        double[] out = new double[3];
        for (Turtle t1 : myTies) {
          try {
            Turtle3D t = (Turtle3D) t1;
            Link link = linkManager.findLink(root, t, world3D.links(), true);
            boolean rigid = link.mode().equals(Link.MODE_FIXED);

            // In order to get wrapping and line drawing to work properly
            // we have to compute our transform in coordinates relative to the
            // root turtle -- CLB 05/11/06
            double[] leaf = ((Protractor3D) (world3D.protractor())).towardsVector
                (root.xcor(), root.ycor(), root.zcor(),
                    t.xcor(), t.ycor(), t.zcor(), true);
            htrans.transform(leaf, out, 1);
            ptrans.transform(out, out, 1);
            rtrans.transform(out, out, 1);
            double nx = t.xcor + (out[0] - leaf[0]);
            double ny = t.ycor + (out[1] - leaf[1]);
            double nz = t.zcor + (out[2] - leaf[2]);

            Set<Turtle3D> snapshot = seenTurtles;
View Full Code Here

TOP

Related Classes of org.nlogo.api.Matrix3D

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.