User Tools

Site Tools


visual3d:documentation:pipeline:expressions:intersection_functions
====== Intersection Functions ======

This page contains a list of all functions that find point, line, and plane intersections.

Line-Line Intersect

Line_Line_Intersect(line1, line2, line3, line4, tolerance)

  • vector1 is defined by vertices line1 and line2
  • vector2 is defined by vertices line3 and line4
  • two vectors in 3D space rarely intersect precisely.
  • tolerance is the maximum distance at the closest point of the two vectors that will be labeled an intersection
  • the default value of the tolerance=0.01



Line Plane Intersect

Line_Plane_Intersect(line1, line2, plane1, plane2, plane3)

  • Line1 and line 2 define the vector
  • Plane1, Plane2, and Plane3 define the plane

Line_Plane_Intersect(line1, line2, plane)

  • Line1 and line 2 define the vector
  1. Plane defines the plane (for example, a best fit plane)




Project Point On Plane

Project_Point_On_Plane(plane, point).





Point Distance To Plane

Point_Distance_To_Plane(plane, point).





Point Distance To Line

Point_Distance_To_Line(point_on_vector, vector, point).

  • Compute perpendicular distance from a point to a line.





Is Point Inside Polygon

Is_Point_Inside_Polygon(Point1, Vertex1, Vertex2, Vertex3, …)

  • Is a Point inside a planar polygon comprised of any number of vertices?

Example: Create a polygon comprising 4 vertices, check to see if a point is inside the Polygon

Metric_Explicit
/RESULT_METRIC_FOLDER=VERTEX
/RESULT_METRIC_NAME=V1
/METRIC_VALUE=VECTOR(0,0,0)
;

Metric_Explicit
/RESULT_METRIC_FOLDER=VERTEX
/RESULT_METRIC_NAME=V2
/METRIC_VALUE=VECTOR(1,0,0)
;

Metric_Explicit
/RESULT_METRIC_FOLDER=VERTEX
/RESULT_METRIC_NAME=V3
/METRIC_VALUE=VECTOR(1,1,0)
;

Metric_Explicit
/RESULT_METRIC_FOLDER=VERTEX
/RESULT_METRIC_NAME=V4
/METRIC_VALUE=VECTOR(0,1,0)
;

Evaluate_Expression
/EXPRESSION=Is_Point_Inside_Polygon(
VECTOR(0.5,0.5,0),
METRIC::VERTEX::V1,
METRIC::VERTEX::V2,
METRIC::VERTEX::V3,
METRIC::VERTEX::V4
)
/SIGNAL_TYPES=
/SIGNAL_FOLDER=
/SIGNAL_NAMES=
/RESULT_TYPES=METRIC
/RESULT_FOLDERS=POLYGON
/RESULT_NAME=TEST_IN
! /APPLY_AS_SUFFIX_TO_SIGNAL_NAME=FALSE
;
Expression Result : 1.000000

Evaluate_Expression
/EXPRESSION=Is_Point_Inside_Polygon(
VECTOR(0.5,0.5,0.5),
METRIC::VERTEX::V1,
METRIC::VERTEX::V2,
METRIC::VERTEX::V3,
METRIC::VERTEX::V4
)
/SIGNAL_TYPES=
/SIGNAL_FOLDER=
/SIGNAL_NAMES=
/RESULT_TYPES=METRIC
/RESULT_FOLDERS=POLYGON
/RESULT_NAME=TEST_IN
! /APPLY_AS_SUFFIX_TO_SIGNAL_NAME=FALSE
;
Expression Result : 0.000000

Bounding_Box

Bounding_Box(Start_Event, End_Event, Signal1, Signal2, Signal3, ….., nMovingbox)

  • Construct a box from list of points.
  • The box is the bounding box of the point set.
  • At least 3 Locations are required (Signal1, …..)
  • nMovingBox = integer indicating moving or static box with event sequence
    • 0 = static across event_sequence
    • 1 = computed frame by frame across event_sequence
  • The resulting bounding box is aligned with the Laboratory Coordinate System.

Example: Create a 4 targets representing the vertices of the box, and create a bounding box around these targets that will be tracked across an event sequence.

! Creating Targets V1, V2, V3, V4

Create_Target
/SIGNAL_NAMES=V1+V2+V3+V4
/SIGNAL_DESCRIPTION=V1+V2+V3+V4
/EXPRESSION='vector(-0.2,0,0)','vector(0.2,0,0)','vector(0.15,0.2,0)','vector(0.1,0.1,0.2)'
! /INCLUDE_MOTIONFILE=TRUE
! /INCLUDE_CALFILE=FALSE
;

! Create two even labels for an event sequence (start and end of trial for this example)
Event_Explicit
/EVENT_NAME=START
/FRAME=1
! /TIME=
;

Event_Explicit
/EVENT_NAME=END
/FRAME=EOF
! /TIME=
;

! Creating bounding box using START and END event labels, the 4 V targets
! nMovingBox set to 1 to be tracked at each frame between events START and END

Evaluate_Expression
/EXPRESSION=BOUNDING_BOX(CURRENT_SIGNAL,1)
/SIGNAL_TYPES=EVENT_LABEL+EVENT_LABEL+TARGET+TARGET+TARGET+TARGET
/SIGNAL_FOLDER=ORIGINAL
/SIGNAL_NAMES=START+END+V1+V2+V3+V4
! /RESULT_TYPES=DERIVED
/RESULT_FOLDERS=BOUNDING_BOX
/RESULT_NAME=BOX
! /APPLY_AS_SUFFIX_TO_SIGNAL_NAME=FALSE
;

Example cont.: Illustrating the Bounding Box.

! The following command can be used to create 8 targets that define the minimum bounding box stored in the signal DERIVED::BOUNDING_BOX::BOX

Create_Targets_For_Base_Of_Support
/SIGNAL_NAMES=B
/SIGNAL_DESCRIPTION=B
/EXPRESSION=DERIVED::BOUNDING_BOX::BOX
/NUM_TARGETS=8
;
visual3d/documentation/pipeline/expressions/intersection_functions.txt · Last modified: 2025/01/23 16:49 by wikisysop