cubeRotations.frink

Download or view cubeRotations.frink in plain text format


// Analyze all rotation matrices for a rigid cube.

// Rotations around the Y axis to orient the sensor 4 different ways
angles = [0 deg, 90 deg, 180 deg, 270 deg]

// Rotations to point along all 6 directions
rots = [[0,0,0], [0,0,90 deg], [0,0,180 deg], [0,0,270 deg], [90 deg,0,0], [-90 deg, 0,0]]


for angle = angles
{
   rot1 = callJava["frink.graphics.CoordinateTransformer3DFloat","makeRotateY", [0,0,0,angle]]

   for [xv, yv, zv] = rots
   {
      rot2 = callJava["frink.graphics.CoordinateTransformer3DFloat","makeRotateXYZ",[0,0,0, xv, yv, zv]]
      ct = rot2.multiply[rot1].round[]
      println[formatMatrix[formatFix[ct.toExpression[],1,0]]]
   }
}


Download or view cubeRotations.frink in plain text format


This is a program written in the programming language Frink.
For more information, view the Frink Documentation or see More Sample Frink Programs.

Alan Eliasen was born 20143 days, 9 hours, 57 minutes ago.