====== Intersection Functions ======
This page contains a list of all functions that find point, line, and plane intersections.
==== Line-Line Intersect ====
{{ visual3D:documentation:pipeline:expressions:line-line-intersect.png?330}}
**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 ====
{{ visual3D:documentation:pipeline:expressions:line-plane-intersect.png?350}}
**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
- Plane defines the plane (for example, a best fit plane)
\\
\\
\\
{{ visual3D:documentation:pipeline:expressions:point-on-plane.png?225}}
==== Project Point On Plane ====
**Project_Point_On_Plane**(plane, point).
* Project a point onto a plane.
* [[https://en.wikipedia.org/wiki/Euclidean_plane|The resulting plane is defined by 4 components]]
\\
\\
\\
\\
{{ visual3D:documentation:pipeline:expressions:point-dist-plane.png?175}}
==== Point Distance To Plane ====
**Point_Distance_To_Plane**(plane, point).
* Compute perpendicular distance from a point to a plane.
* [[https://en.wikipedia.org/wiki/Euclidean_plane|The resulting plane is defined by 4 components]]
\\
\\
\\
\\
{{ visual3D:documentation:pipeline:expressions:point-on-line.png?175}}
==== Point Distance To Line ====
**Point_Distance_To_Line**(point_on_vector, vector, point).
* Compute perpendicular distance from a point to a line.
\\
\\
\\
\\
{{ visual3D:documentation:pipeline:expressions:point-in-polygon.png?300}}
==== 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 ====
{{ visual3D:documentation:pipeline:expressions:BoundingBox.png?200}}
**Bounding_Box**(Start_Event, End_Event, Signal1, Signal2, Signal3, ....., nMovingbox)
* Construct a box from list of points.
* The box is the [[https://en.wikipedia.org/wiki/Minimum_bounding_box|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. The bounding box signal is a 24 column signal containing the X,Y,Z position of 8 vertices.
Example: Create 4 arbitrary targets, 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
;
==== Base_Of_Support ====
{{ visual3D:documentation:pipeline:expressions:BOSDiagram.png?300}}
**Base_Of_Support**(Signal,Plane)
* Construct a 2D base of support projected onto a plane from a Bounding Box.
* The signal input is the [[https://en.wikipedia.org/wiki/Minimum_bounding_box|bounding box]] of the point set, a 24 column signal containing the X,Y,Z position of 8 vertices.
* The [[visual3d:documentation:pipeline:expressions:least_squares_fitting_of_data#best_fit_plane|Plane]] parameter is the plane to project the Box onto.
* The resulting base of support is a 2D projection of the signal onto the plane. The base of support is a 12 column signal containing the X,Y,Z position of 4 vertices (C1-C4 in the image to the right).
Example: Create a bounding box around 4 targets between events START and END, and project that box onto the ground using the Base_Of_Support command.
! Create a bounding box using 4 targets V1,V2,V3,V4 to be tracked 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
;
! Project the bounding box onto the X-Y plane of the laboratory
Evaluate_Expression
/EXPRESSION=BASE_OF_SUPPORT(CURRENT_SIGNAL,VECTOR(0,0,1,0))
/SIGNAL_TYPES=DERIVED
/SIGNAL_FOLDER=BOUNDING_BOX
/SIGNAL_NAMES=BOX
! /SIGNAL_COMPONENTS=
! /RESULT_TYPES=DERIVED
/RESULT_FOLDERS=BASE_OF_SUPPORT
/RESULT_NAME=BOS
! /APPLY_AS_SUFFIX_TO_SIGNAL_NAME=FALSE
;
! Create targets of the resulting Base of Support signal for visualization
Create_Targets_For_Base_Of_Support
/SIGNAL_NAMES=BOS
/SIGNAL_DESCRIPTION=BOS
/EXPRESSION=DERIVED::BASE_OF_SUPPORT::BOS
/NUM_TARGETS=8
;
Example: Projecting a bounding box onto a sloped plane.
!Creating 4 vectors defining a corners of plane (such as a sloped floor)
Metric_Explicit
/RESULT_METRIC_FOLDER=FLOOR
/RESULT_METRIC_NAME=F1
/METRIC_VALUE=VECTOR(0,0,0)
;
Metric_Explicit
/RESULT_METRIC_FOLDER=FLOOR
/RESULT_METRIC_NAME=F2
/METRIC_VALUE=VECTOR(0.2,0,0)
;
Metric_Explicit
/RESULT_METRIC_FOLDER=FLOOR
/RESULT_METRIC_NAME=F3
/METRIC_VALUE=VECTOR(0,0.2,0.03)
;
Metric_Explicit
/RESULT_METRIC_FOLDER=FLOOR
/RESULT_METRIC_NAME=F4
/METRIC_VALUE=VECTOR(0.2,0.2,0.03)
;
! Creating a best fit plane using the 4 vectors defined previously
Evaluate_Expression
/EXPRESSION=BEST_FIT_PLANE(CURRENT_SIGNAL)
/SIGNAL_TYPES=METRIC
/SIGNAL_FOLDER=FLOOR
/SIGNAL_NAMES=F1+F2+F3+F4
! /SIGNAL_COMPONENTS=
/RESULT_TYPES=METRIC
/RESULT_FOLDERS=FLOOR
/RESULT_NAME=PLANE
! /APPLY_AS_SUFFIX_TO_SIGNAL_NAME=FALSE
;
! Projecting a bounding box onto the plane to create a base of support
Evaluate_Expression
/EXPRESSION=BASE_OF_SUPPORT(CURRENT_SIGNAL,METRIC::FLOOR::PLANE)
/SIGNAL_TYPES=DERIVED
/SIGNAL_FOLDER=BOUNDING_BOX
/SIGNAL_NAMES=BOX
! /SIGNAL_COMPONENTS=
! /RESULT_TYPES=DERIVED
/RESULT_FOLDERS=BASE_OF_SUPPORT
/RESULT_NAME=BOS2
! /APPLY_AS_SUFFIX_TO_SIGNAL_NAME=FALSE
;
! Highlighting the base of support with targets
Create_Targets_For_Base_Of_Support
/SIGNAL_NAMES=BOS
/SIGNAL_DESCRIPTION=BOS
/EXPRESSION=DERIVED::BASE_OF_SUPPORT::BOS2
/NUM_TARGETS=8
;
==== Extrapolated_COG ====
**EXTRAPOLATED_COG**(Signal,Signal,Model Metric)
* Computes the extrapolated COG or the [[https://www.sciencedirect.com/science/article/abs/pii/S0021929004001642?via%3Dihub|'extrapolated center of mass position']] using the following equation:
* xCoM = CoM + vCoM/sqrt(g/l)
* Expression requires three inputs:
* The first signal input is considered as the CoM position,
* second input is considered the velocity of the CoM,
* and the third input is the leg length of the model.
Example: Deriving the extrapolated CoM
Evaluate_Expression
/EXPRESSION=EXTRAPOLATED_COG(CURRENT_SIGNAL,MODEL::METRIC::LEG_LENGTH)
/SIGNAL_TYPES=LINK_MODEL_BASED+LINK_MODEL_BASED
/SIGNAL_FOLDER=ORIGINAL+ORIGINAL
/SIGNAL_NAMES=COG+COG_VELOCITY
! /RESULT_TYPES=DERIVED
/RESULT_FOLDERS=BASE_OF_SUPPORT
/RESULT_NAME=XCOG
! /APPLY_AS_SUFFIX_TO_SIGNAL_NAME=FALSE
;
==== Margin_Of_Stability ====