isometricProjection.frink

Download or view isometricProjection.frink in plain text format


/** This contains routines to derive equations for isometric projection.

    See: https://en.wikipedia.org/wiki/Isometric_projection
*/


use Matrix.frink

symbolicMode[true]
t1 = new Matrix[[[sqrt[3], 0, -sqrt[3]],
                 [1,       2,     1   ],
                 [sqrt[2], -sqrt[2], sqrt[2]]]]

c = new Matrix[([ax, ay, az]).transpose[]]

d = t1.multiply[c].multiplyByScalar[1/sqrt[6]]

println[d.formatMatrix[]]

bt = new Matrix[[[1,0,0], [0,1,0], [0,0,0]]]

f = bt.multiply[d]
println[f.formatMatrix[]]

// All of this comes out to:

// bx = sqrt[2] (ax - az)
// by = sqrt[1/6] (ax + 2 ay + az)
// bz = sqrt[3] (ax - ay + az)   
//     (There really isnt' a z but if you want to color code it)

// The minima and maxima are:
// min bx = sqrt[2] (axmin - azmax)
// max bx = sqrt[2] (axmax - azmin)
// min by = sqrt[1/6] (axmin + 2 aymin + azmin)
// max by = sqrt[1/6] (axmax + 2 aymax + azmax)
// min bz = sqrt[3] (axmin - aymax + azmin)
// max bz = sqrt[3] (axmax - aymin + azmax)

// Or, inverted,
// ay = -ax + bx/(2*Sqrt[2]) + Sqrt[3/2]*by
// az = ax - bx/Sqrt[2]


Download or view isometricProjection.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 19346 days, 22 hours, 35 minutes ago.