base_axis

EXPRESS specification:

FUNCTION base_axis
(* Modified for LPM/6 *)(dim : INTEGER; axis1, axis2, axis3 : direction) : LIST [2:3] OF direction; LOCAL u : LIST [2:3] OF direction; factor : REAL; d1, d2 : direction; END_LOCAL; IF (dim = 3) THEN d1 := NVL(normalise(axis3), dummy_gri || direction([0.0,0.0,1.0])); d2 := first_proj_axis(d1,axis1); u := [d2, second_proj_axis(d1,d2,axis2), d1]; ELSE IF EXISTS(axis1) THEN d1 := normalise(axis1); u := [d1, orthogonal_complement(d1)]; IF EXISTS(axis2) THEN factor := dot_product(axis2,u[2]); IF (factor < 0.0) THEN u[2].direction_ratios[1] := -u[2].direction_ratios[1]; u[2].direction_ratios[2] := -u[2].direction_ratios[2]; END_IF; END_IF; ELSE IF EXISTS(axis2) THEN d1 := normalise(axis2); u := [orthogonal_complement(d1), d1]; u[1].direction_ratios[1] := -u[1].direction_ratios[1]; u[1].direction_ratios[2] := -u[1].direction_ratios[2]; ELSE u := [dummy_gri || direction([1.0, 0.0]), dummy_gri || direction([0.0, 1.0])]; END_IF; END_IF; END_IF; RETURN(u);
END_FUNCTION;