FUNCTION normalise
(* SCHEMA step_merged_ap_schema; *)
-- DIFF IN AP214
-- DIFF IN AP203e2
-- DIFF IN AP224
-- DIFF IN AP232
FUNCTION normalise
(arg : vector_or_direction ) : vector_or_direction;
LOCAL
ndim : INTEGER;
v : direction := dummy_gri || direction([ 1.0, 0.0, 0.0 ]);
result : vector_or_direction;
vec : vector := dummy_gri || vector(v, 1.0);
mag : REAL;
END_LOCAL;
IF NOT EXISTS(arg) THEN
result := ?;
ELSE
ndim := arg.dim;
IF 'STEP_MERGED_AP_SCHEMA.VECTOR' IN TYPEOF(arg) THEN
BEGIN
v := dummy_gri || direction(arg\vector.orientation.direction_ratios);
IF arg\vector.magnitude = 0.0 THEN
RETURN (?);
ELSE
vec := dummy_gri || vector(v, 1.0);
END_IF;
END;
ELSE
v := dummy_gri || direction(arg.direction_ratios);
END_IF;
mag := 0.0;
REPEAT i := 1 TO ndim;
mag := mag + v.direction_ratios[i] * v.direction_ratios[i];
END_REPEAT;
IF mag > 0.0 THEN
mag := SQRT(mag);
REPEAT i := 1 TO ndim;
v.direction_ratios[i] := v.direction_ratios[i] / mag;
END_REPEAT;
IF 'STEP_MERGED_AP_SCHEMA.VECTOR' IN TYPEOF(arg) THEN
vec.orientation := v;
result := vec;
ELSE
result := v;
END_IF;
ELSE
RETURN (?);
END_IF;
END_IF;
RETURN (result);
END_FUNCTION;
Referenced By
Defintion normalise is references by the following definitions:
[Top Level Definitions] [Exit]Generated by STEP Tools® EXPRESS to HTML Converter
2024-09-06T14:00:33-04:00