Compute Distance Map: Difference between revisions

From Software Product Documentation
Jump to navigation Jump to search
m (Text replacement - "www.c-motion.com/download" to "www.has-motion.com/download")
 
(29 intermediate revisions by the same user not shown)
Line 7: Line 7:
=Compute Distance Map=
=Compute Distance Map=


This command will color a region of interest (ROI) on an OBJ file created from DSX with a distance map and calculate the contact point.
This command will color two regions of interest (ROI) on opposing segments, and calculate the weighted-average contact point on each one. The ROIs are defined in OBJ files created with DSX.


Distance maps:
Distance maps:
Line 14: Line 14:
Contact point:
Contact point:
* The overall minimum distance is calculated ([[Compute_Distance_Map#Minimum_Distance|_Min]])
* The overall minimum distance is calculated ([[Compute_Distance_Map#Minimum_Distance|_Min]])
* The contact path is the weighted minimum distance ([[Compute_Distance_Map#Contact_Path|_Contact]])
* The contact point is the weighted minimum distance ([[Compute_Distance_Map#Contact_Path|_Contact]])


<!--
<!--
https://c-motion.com/download/Katie/DistanceMaps/contact path.mp4
https://c-motion.com/download/Katie/DistanceMaps/contact path.mp4


<HTML5video width="520" height="320" autoplay="true" loop="true"> https://www.c-motion.com/download/Katie/DistanceMaps/contact%20path.mp4 </HTML5video>
<HTML5video width="520" height="320" autoplay="true" loop="true"> https://www.has-motion.com/download/Katie/DistanceMaps/contact%20path.mp4 </HTML5video>


-->
-->
Line 37: Line 37:


-->
-->
==Background==
A polygonal surface mesh is defined by a set of faces, each of which is defined by a set of vertices connected by edges. Before computing distances, the Compute Distance Map command divides all faces of the ROIs into triangles, for easier processing and to guarantee that all faces are planar. In the image below, the left image highlights the vertices used to define a surface and the right image displays the triangles that define the surface:
[[File:compute distance map vertex triangles.png|600px]]
A normal vector is defined for each triangle, vertex and edge:
[[File:compute distance map normals.png|600px|link=https://www.scratchapixel.com/lessons/3d-basic-rendering/introduction-to-shading/shading-normals]]


==Command Output==
==Command Output==
Line 50: Line 60:
|}
|}
</b>
</b>
The result for _Min and _Contact will have 4 components. The first three components are X Y Z location of the contact point in the segment coordinate system, and the fourth component is the minimum distance. You can use the [[Transform_Data_Coordinate_System]] command to transform the resulting coordinate system of the contact point.


===Minimum Distance===
===Minimum Distance===
Line 55: Line 67:
{| style= width="100%"
{| style= width="100%"
| style="width: 50%" align="left" style="vertical-align:top"|  
| style="width: 50%" align="left" style="vertical-align:top"|  
The minimum distance between the two segments.
The minimum distance between each triangle on one segment's ROI and the opposing segment's ROI.


* This single distance value is calculated for each face and is the distance of the smallest value of:
* A single distance value is calculated for each triangle, and is the smallest value of these candidates:
** (a) the closest of its 3 vertices
** (a) the distance from the opposing ROI to the closest of the triangle's vertices
** (b) a vertex on the other surface that projects onto the triangle (slide 4)
** (b) the distance from the closest vertex on the opposing ROI that projects onto the face of the triangle (left image)
** (c) an edge on the other surface that projects onto the triangle (new slide)
** (c) the distance from the closest vertex on the opposing ROI that projects onto an edge of the triangle (right image)
| style= "width: 50%" align="right" style="vertical-align:top"|  
| style= "width: 50%" align="right" style="vertical-align:top"|  
[[File:compute distance map min distance calc.png|200px|frame|words]]
[[File:compute distance map min distance calc.png|600px]]
|}
|}


===Contact Path===
===Contact Point===


The weighted minimum distance between the two segments.
The weighted minimum distance between the two segments.


* Once each face has been assigned a minimum distance, a preliminary contact point is found by calculating a weighted average of all the triangle centers. Each center is weighted by the triangle's area and the square of its distance. The area threshold percentage indicates the percent of the total number of faces on the surface to be included in the calculation. Then the weighted contact point is projected onto the surface of the segment (since the averaged point could be above or below the surface of the segment).
* Once each triangle has been assigned a minimum distance, a preliminary contact point is found by calculating a weighted average of all the triangle centers. Each center is weighted by the triangle's area and the square of its distance. The area threshold percentage (CONTACT_POINT_AREA_THRESHOLD) specifies the percentage of the total area of triangles on the ROI to be included in the calculation. This weighted-average point is usually not on the surface of the ROI, so it is projected onto the surface using the normal of the closest ROI vertex.


===Min Vertex Distances===
===Min Vertex Distances===
Line 79: Line 91:
===Sign of the Minimum Distance===
===Sign of the Minimum Distance===


{| style= width="100%"
Any of the distances calculated by this command can be positive (the opposing ROI surfaces do not intersect) or negative (the surfaces intersect). The sign of each distance is calculated using the appropriate normal vector (triangle, edge, or vertex). For example, to determine which side of a triangle a given vertex is on, the vector from the vertex to the triangle is compared to the normal of the triangle.
| style="width: 50%" align="left" style="vertical-align:top"|
The sign of the minimum distance (positive or negative) is determined by projecting the distance onto the face, vertex or edge normals (depending on the test). The sign of the projection defines the sign used for the minimum.
| style= "width: 50%" align="right" style="vertical-align:top"|
[[File:compute distance map normals.png|600px|link=https://www.scratchapixel.com/lessons/3d-basic-rendering/introduction-to-shading/shading-normals]]
|}


==Command Dialog==
==Command Dialog==
Line 102: Line 109:
* Inner Color
* Inner Color
** Specifies the mid color and the gradient
** Specifies the mid color and the gradient
* Max Color & Value -
* Max Color & Value  
** Determines the color for the maximum value
** Determines the color for the maximum value
** All vertices with a maximum distance greater than the value specified will have this color
** All vertices with a maximum distance greater than the value specified will have this color
Line 124: Line 131:
{| style= width="100%"
{| style= width="100%"
| style="width: 50%" align="left" style="vertical-align:top"|  
| style="width: 50%" align="left" style="vertical-align:top"|  
You can draw the contact point and it's path on the surface:
You can draw the contact point and its path on the surface:
| style= "width: 50%" align="right" style="vertical-align:top"|  
| style= "width: 50%" align="right" style="vertical-align:top"|  
[[Image:contactPath.png|400px]]
[[Image:contactPath.png|400px]]
Line 156: Line 163:
** Trail thickness specifies the thickness of the path
** Trail thickness specifies the thickness of the path
| style= "width: 50%" align="right" style="vertical-align:top"|  
| style= "width: 50%" align="right" style="vertical-align:top"|  
[[Image:contactPath draw properties.png|400px]]
[[Image:contactPath draw properties.png|300px]]
|}
|}
<b>NOTE:</b> If the contact point is still too large, go to <b>Settings -> Modify Scale of 3D Graphics</b> and decrease the Target Size.


===Camera Settings===
===Camera Settings===

Latest revision as of 11:20, 22 May 2024

Language:  English  • français • italiano • português • español 

Compute Distance Map

This command will color two regions of interest (ROI) on opposing segments, and calculate the weighted-average contact point on each one. The ROIs are defined in OBJ files created with DSX.

Distance maps:

  • Each vertex is colored according to its closest distance to the other surface (which can be to a vertex, edge, or triangle of the other surface). Smooth shading is used so that a triangle's color is a linear combination of the colors of its three vertices.

Contact point:

  • The overall minimum distance is calculated (_Min)
  • The contact point is the weighted minimum distance (_Contact)


Background

A polygonal surface mesh is defined by a set of faces, each of which is defined by a set of vertices connected by edges. Before computing distances, the Compute Distance Map command divides all faces of the ROIs into triangles, for easier processing and to guarantee that all faces are planar. In the image below, the left image highlights the vertices used to define a surface and the right image displays the triangles that define the surface:

A normal vector is defined for each triangle, vertex and edge:

Command Output

For every Result Name specified, there will be 6 results:

  • ResultName_SegmentName_Min
  • ResultName_SegmentName_Contact
  • ResultName_SegmentName_Vert

The result for _Min and _Contact will have 4 components. The first three components are X Y Z location of the contact point in the segment coordinate system, and the fourth component is the minimum distance. You can use the Transform_Data_Coordinate_System command to transform the resulting coordinate system of the contact point.

Minimum Distance

The minimum distance between each triangle on one segment's ROI and the opposing segment's ROI.

  • A single distance value is calculated for each triangle, and is the smallest value of these candidates:
    • (a) the distance from the opposing ROI to the closest of the triangle's vertices
    • (b) the distance from the closest vertex on the opposing ROI that projects onto the face of the triangle (left image)
    • (c) the distance from the closest vertex on the opposing ROI that projects onto an edge of the triangle (right image)

Contact Point

The weighted minimum distance between the two segments.

  • Once each triangle has been assigned a minimum distance, a preliminary contact point is found by calculating a weighted average of all the triangle centers. Each center is weighted by the triangle's area and the square of its distance. The area threshold percentage (CONTACT_POINT_AREA_THRESHOLD) specifies the percentage of the total area of triangles on the ROI to be included in the calculation. This weighted-average point is usually not on the surface of the ROI, so it is projected onto the surface using the normal of the closest ROI vertex.

Min Vertex Distances

This is the minimum distance value that is used to color each vertex in the OBJ.

Note: Do not click on this signal and open the data view, Visual3D will not be able to open the data view due to the number of columns.

Sign of the Minimum Distance

Any of the distances calculated by this command can be positive (the opposing ROI surfaces do not intersect) or negative (the surfaces intersect). The sign of each distance is calculated using the appropriate normal vector (triangle, edge, or vertex). For example, to determine which side of a triangle a given vertex is on, the vector from the vertex to the triangle is compared to the normal of the triangle.

Command Dialog

Result Signal Information:

  • Result Type: Derived
  • Result Folder: Result can be stored in any folder
  • Result Name: One result name for each region you are comparing

Color Map:

  • Min Color & Value
    • Determines the color for the minimum value
    • All vertices with a minimum distance less than the value specified will have this color
  • Inner Color
    • Specifies the mid color and the gradient
  • Max Color & Value
    • Determines the color for the maximum value
    • All vertices with a maximum distance greater than the value specified will have this color

Event Sequence:

  • Without an event sequence the distance map will be created over all frames of data where the segments exist
  • When an event sequence is specified the distance map will only be calculated for the specified frames (can be more time efficient to only analyze the time period of interest)

Regions:

  • Segment Names: Specify the name of the segments to be compared
  • Proximal Region & Sub Region:
    • The regions correlate to the regions of interest created in the DSX suite
  • Contact Point Area Threshold

Drawing the Contact Path

You can draw the contact point and its path on the surface:

Steps

For every Result Name specified, there will be 6 results:

  • ResultName_SegmentName_Contact
  • ResultName_SegmentName_Min
  • ResultName_SegmentName_Vert

Right click on the _Min or _Contact to specify the draw properties

  • Target Size:
    • Size of contact path (small, medium, large or hide)
    • Note: Size of contact path can be modified further by going to
      • Settings -> Modify Scale of the 3D graphics Objects
      • Modify the target size
  • Target Color:
    • Specify the color of the contact point
  • Trails:
    • Specify the color for the contact path and the number of frames before/after the current frame to draw the path
    • Trail thickness specifies the thickness of the path

NOTE: If the contact point is still too large, go to Settings -> Modify Scale of 3D Graphics and decrease the Target Size.

Camera Settings

The skeleton toggle button on the toolbar turns segment drawings on/off:

  • All on
  • Kinematic on
  • Kinetic on
  • All off

You can set one segment to be always drawn by right click on the segment name under Kinetic_Kinematic in the data tree, and selecting "Draw Segment Properties". Check "Draw Segment (Override Visual3D Global Draw)", this means the segment will always be drawn.

You can manually adjust the camera perspective:

  • Right Mouse: Zoom in/out
  • Left Mouse: Rotation
  • Right + Left Mouse: Translate

You can set the camera perspective to lock onto a segment by going to View -> Set Camera Perspective.

Retrieved from ""