scalar_times_vector

EXPRESS specification:

FUNCTION scalar_times_vector
(* Modified for LPM/6 *)(scalar : REAL; vec : vector_or_direction) : vector; LOCAL v : direction; mag : REAL; result : vector; END_LOCAL; IF NOT EXISTS (scalar) OR NOT EXISTS (vec) THEN RETURN (?) ; ELSE IF 'STRUCTURAL_FRAME_SCHEMA.VECTOR' IN TYPEOF (vec) THEN v := dummy_gri || direction(vec.orientation.direction_ratios); mag := scalar * vec.magnitude; ELSE v := dummy_gri || direction(vec.direction_ratios); mag := scalar; END_IF; IF (mag < 0.0 ) THEN REPEAT i := 1 TO SIZEOF(v.direction_ratios); v.direction_ratios[i] := -v.direction_ratios[i]; END_REPEAT; mag := -mag; END_IF; result := dummy_gri || vector(normalise(v), mag); END_IF; RETURN (result);
END_FUNCTION;