FUNCTION scalar_times_vector

(* SCHEMA STRUCTURAL_FRAME_SCHEMA; *)

(* Modified for LPM/6 *)
FUNCTION scalar_times_vector 
	(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;  (*  STEP Part 42 (modified in 2nd edition)  *)

Referenced By

Defintion scalar_times_vector is references by the following definitions:
DefinitionType
 first_proj_axis FUNCTION
 second_proj_axis FUNCTION


[Top Level Definitions] [Exit]

Generated by STEP Tools® EXPRESS to HTML Converter
2023-03-25T00:11:39-04:00