|
FUNCTION get_relative_direction_2points (cp1 : cartesian_point, cp2 : cartesian_point) : direction; LOCAL d1 , d2 , d3 , magnitude : REAL ; result : direction := ? ; END_LOCAL ; IF ( ( cp1 . dim <> 3 ) OR ( cp2 . dim <> 3 ) ) THEN RETURN ( result ) ; ELSE BEGIN d1 := cp2 . coordinates [ 1 ] - cp1 . coordinates [ 1 ] ; d2 := cp2 . coordinates [ 2 ] - cp1 . coordinates [ 2 ] ; d3 := cp2 . coordinates [ 3 ] - cp1 . coordinates [ 3 ] ; magnitude := SQRT ( d1 * d1 + d2 * d2 + d3 * d3 ) ; IF ( magnitude = 0 ) THEN RETURN ( result ) ; END_IF ; result := dummy_gri || direction ( [ d1 , d2 , d3 ] ) ; END ; END_IF ; RETURN ( result ) ; END_FUNCTION; -- get_relative_direction_2points |
|
public class FGet_relative_direction_2points public static Value run(SdaiContext _context, Value cp1, Value cp2) |