![]() |
NDEVR
API Documentation
|
Computes gravity-based intersection transforms by casting rays along a gravity vector and finding where they intersect scene geometry. More...
Public Member Functions | |
| Matrix< fltp08 > | calculateIntersection () const |
| Calculates an intersection transform by projecting query points along the gravity vector and fitting a rotation and translation from original positions to intersection positions. | |
| void | setup (DesignObjectLookup *lookup, const Matrix< fltp08 > &mat, const Buffer< Vertex< 3, fltp08 > > &points) |
| Initializes the gravity intersection with the required scene context, transform, and query points. | |
Static Public Member Functions | |
| static Buffer< Vertex< 3, fltp08 > > | FilterSamples (fltp08 cluster_distance, Buffer< Vertex< 3, fltp08 > > clustered_points, Vertex< 3, fltp08 > center) |
| Filters a set of points by iteratively extracting the lowest-Z point and removing nearby neighbors within a clustering distance. | |
| static Buffer< Vertex< 3, fltp08 > > | FindGravityPoints (const Model &model, fltp08 delta, fltp08 max) |
| Generates a set of gravity sample points by casting vertical rays through a model's bounding area. | |
| static Vertex< 3, fltp08 > | LowestPoint (const Buffer< Vertex< 3, fltp08 > > &clustered_points) |
| Finds the vertex with the lowest Z coordinate from a set of points. | |
Protected Attributes | |
| Matrix< fltp08 > | m_current_transform |
| The transformation matrix applied to query points before performing intersection queries. | |
| Vector< 3, fltp08 > | m_gravity_vector = Vector<3, fltp08>(0, 0, -1) |
| The direction of gravity used for raycasting. Defaults to downward along the Z axis. | |
| DesignObjectLookup * | m_lookup = nullptr |
| Pointer to the scene lookup used for selection/intersection queries. Not owned by this class. | |
| fltp08 | m_max_fall_height = 100.0 |
| The maximum distance to cast rays along the gravity vector in each direction from a query point. | |
| Buffer< Vertex< 3, fltp08 > > | m_query_points |
| The set of local-space query points to project along the gravity vector. | |
Computes gravity-based intersection transforms by casting rays along a gravity vector and finding where they intersect scene geometry.
GravityIntersection projects a set of query points along a gravity direction, finds the nearest surface intersections in the scene, and computes a best-fit rotation and translation matrix that aligns the original point plane to the intersection point plane. This is useful for settling or dropping objects onto terrain or other surfaces.
Definition at line 16 of file GravityIntersection.h.
Calculates an intersection transform by projecting query points along the gravity vector and fitting a rotation and translation from original positions to intersection positions.
The method casts line segments along the gravity vector from each query point, performs selection queries against the scene to find nearest surface hits, then computes a best-fit plane for both the original and intersection point sets. A rotation matrix is derived using Rodrigues' rotation formula to align the two planes, combined with an average translation offset.
Definition at line 38 of file GravityIntersection.h.
References Buffer< t_type, t_memory_manager >::add(), allow_interactions, cast(), SelectionInfo::clearLastSelection(), cross(), SelectionInfo::current_selection, dot(), SelectionInfo::is_exact, IsInvalid(), IsValid(), LineSegment< t_dims, t_type, t_vertex >::lengthSquared(), m_current_transform, m_gravity_vector, m_lookup, m_max_fall_height, m_query_points, SelectionInfo::min_screen_cutoff_distance, ModelIterator::model_filter, SelectionInfo::nearest_line, SelectionInfo::nearest_point, SelectionInfo::nearest_solid, SelectionInfo::nearestScreenLocation(), Vector< t_dims, t_type >::normalized(), SelectionInfo::ClosestModelInfo::screen_distance, skew(), and spacial_visible.
|
inlinestatic |
Filters a set of points by iteratively extracting the lowest-Z point and removing nearby neighbors within a clustering distance.
For each iteration, the point with the lowest Z value is found. All points within the specified cluster distance are removed from the input set. Among tied Z values, the point closest to the provided center is preferred. This produces a reduced set of representative low points spread across the spatial domain.
| [in] | cluster_distance | The squared distance threshold for clustering nearby points. |
| [in] | clustered_points | The input buffer of points to filter (consumed during processing). |
| [in] | center | A reference center point used to break ties among equal-Z candidates. |
Definition at line 243 of file GravityIntersection.h.
References Buffer< t_type, t_memory_manager >::add(), IsValid(), and LowestPoint().
Referenced by FindGravityPoints().
|
inlinestatic |
Generates a set of gravity sample points by casting vertical rays through a model's bounding area.
Iterates over a 2D grid within the model's XY bounding box, casting vertical line segments upward from the minimum Z. For each grid cell, the nearest surface intersection is recorded. The resulting points are then filtered by clustering to remove duplicates, and transformed back into the model's local coordinate space.
| [in] | model | The model whose geometry is sampled for gravity intersection points. |
| [in] | delta | A fraction of the model's largest bounding dimension used as the grid step size. |
| [in] | max | The maximum ray length (height) for vertical intersection queries. |
Definition at line 171 of file GravityIntersection.h.
References Set< t_value >::add(), Bounds< t_dims, t_type, t_vertex >::center(), SelectionInfo::clearLastSelection(), SelectionInfo::current_selection, FilterSamples(), Model::getBoundsOfVisible(), Model::getCompleteTransform(), SelectionInfo::is_exact, IsValid(), SelectionInfo::min_screen_cutoff_distance, SelectionInfo::nearest_line, SelectionInfo::nearest_point, SelectionInfo::nearest_solid, SelectionInfo::nearestScreenLocation(), ModelIterator::parseAll(), SelectionInfo::ClosestModelInfo::screen_distance, Bounds< t_dims, t_type, t_vertex >::span(), SelectionInfo::use_interaction_flag, and Set< t_value >::values().
|
inlinestatic |
Finds the vertex with the lowest Z coordinate from a set of points.
| [in] | clustered_points | The buffer of 3D points to search through. |
Definition at line 211 of file GravityIntersection.h.
Referenced by FilterSamples().
|
inline |
Initializes the gravity intersection with the required scene context, transform, and query points.
| [in] | lookup | The design object lookup used for performing selection queries against scene geometry. |
| [in] | mat | The current transformation matrix applied to the query points before raycasting. |
| [in] | points | The set of query points (in local space) to project along the gravity vector. |
Definition at line 150 of file GravityIntersection.h.
References m_current_transform, m_lookup, and m_query_points.