Struct rayx::Rays¶
A structure representing a collection of rays and their attributes. Each attribute is stored as a vector, allowing for efficient storage and manipulation of multiple rays. The Rays structure supports move semantics for efficient transfers, but disables copy semantics to prevent accidental costly copies. Use thecopy() method to create an explicit copy when needed.More...
#include <Rays.h>
Public Functions¶
| Type | Name |
|---|---|
| Rays () = default |
|
| Rays (Rays &&) = default |
|
| Rays & | append (const Rays & other) Append another Rays instance to this one. |
| RayAttrMask | attrMask () const Get a mask indicating which ray attributes are recorded in this Rays instance. |
| bool | contains (const RayAttrMask attr) const Check if a specific attribute is recorded in this Rays instance. |
| Rays | copy () const Create a copy of the Rays instance. This function is an explicit copy of theRays instance to avoid accidental costly copies. If you want to return aRays instance from a function, you should make use of RVO/NRVO optimizations, instead of using this function. |
| int | count (Pred pred) const |
| glm::dvec3 | direction (const int i) const |
| void | direction (const int i, const glm::dvec3 direction) |
| ElectricField | electric_field (const int i) const |
| void | electric_field (const int i, const ElectricField electric_field) |
| bool | empty () const Check if the ray list is empty. |
| Rays | filter (Pred pred) const |
| Rays & | filterByAttrMask (const RayAttrMask mask) Filter the rays to only include those with attributes specified in the given mask. This operation modifies the current Rays instance in place. |
| Rays | filterByLastEventInPath () const Filter the rays to only include the final event of each unique path. The final event is determined by the maximum path_event_id for each path_id. |
| Rays | filterByObjectId (const int object_id) const Filter the rays to only include those that interacted with a specific object. |
| bool | isValid () const Check if the sizes of all recorded attribute vectors are valid (i.e., all the same length). |
| int | numPaths () const Get the number of unique paths in the ray list. |
| Rays & | operator= (Rays &&) = default |
| RAYX_X_MACRO_RAY_ATTR glm::dvec3 | position (const int i) const |
| void | position (const int i, const glm::dvec3 position) |
| int | size () const Get the number of events in the ray list. |
| Rays | sort (Compare comp) const |
| Rays | sortByObjectId () const Sort rays by object_id, so that rays interacting with the same object are grouped together. |
| Rays | sortByPathIdAndPathEventId () const Sort rays by path_id and then by path_event_id, so that rays belonging to the same path are grouped together, and within each path, rays are ordered by their event sequence. |
Public Static Functions¶
| Type | Name |
|---|---|
| Rays | concat (const std::vector< Rays > & rays_list) Concatenate multiple Rays instances into a singleRays instance. This is more efficient than using repeatedappend() calls. |
Protected Functions¶
| Type | Name |
|---|---|
| Rays (const Rays &) = default Private copy constructor to prevent accidental copies. |
|
| Rays & | operator= (const Rays &) = default Private assignment operator to prevent accidental copies. |
Detailed Description¶
Note:
Ensure that all attribute vectors are of the same length to maintain data integrity.
Public Functions Documentation¶
function Rays [2/3]¶
function Rays [3/3]¶
function append¶
Append another Rays instance to this one.
Parameters:
otherThe Rays instance to append.
Returns:
A reference to this Rays instance after appending.
function attrMask¶
Get a mask indicating which ray attributes are recorded in this Rays instance.
Returns:
A RayAttrMask indicating the recorded attributes.
function contains¶
Check if a specific attribute is recorded in this Rays instance.
Parameters:
attrThe RayAttrMask attribute to check.
Returns:
True if the attribute is recorded, false otherwise.
Note:
When repeatedly checking on the same Rays instance, the free function contains(haystack, needle) should be preferred over this method.
function copy¶
Create a copy of the Rays instance. This function is an explicit copy of theRays instance to avoid accidental costly copies. If you want to return aRays instance from a function, you should make use of RVO/NRVO optimizations, instead of using this function.
Returns:
A new Rays instance that is a copy of the current instance.
function count¶
function direction [1/2]¶
function direction [2/2]¶
function electric_field [1/2]¶
function electric_field [2/2]¶
function empty¶
Check if the ray list is empty.
Returns:
True if the ray list is empty, false otherwise.
function filter¶
function filterByAttrMask¶
Filter the rays to only include those with attributes specified in the given mask. This operation modifies the current Rays instance in place.
Parameters:
maskA RayAttrMask specifying which attributes to retain.
function filterByLastEventInPath¶
Filter the rays to only include the final event of each unique path. The final event is determined by the maximum path_event_id for each path_id.
Returns:
A new Rays instance containing only the final event of each path.
Note:
Requires that path_id and path_event_id are recorded.
function filterByObjectId¶
Filter the rays to only include those that interacted with a specific object.
Parameters:
object_idThe ID of the object to filter by.
Returns:
A new Rays instance containing only rays that interacted with the specified object.
Note:
Requires that object_id is recorded.
function isValid¶
Check if the sizes of all recorded attribute vectors are valid (i.e., all the same length).
Returns:
True if all recorded attribute vectors have the same length, false otherwise.
function numPaths¶
Get the number of unique paths in the ray list.
Returns:
The number of unique path IDs in the ray list.
Note:
Requires that path_id is recorded.
function operator=¶
function position [1/2]¶
function position [2/2]¶
function size¶
Get the number of events in the ray list.
Returns:
The number of events in the ray list.
function sort¶
function sortByObjectId¶
Sort rays by object_id, so that rays interacting with the same object are grouped together.
Returns:
A new Rays instance with rays sorted by object_id.
Note:
Requires that object_id is recorded.
function sortByPathIdAndPathEventId¶
Sort rays by path_id and then by path_event_id, so that rays belonging to the same path are grouped together, and within each path, rays are ordered by their event sequence.
Returns:
A new Rays instance with rays sorted by path_id and path_event_id.
Note:
Requires that path_id and path_event_id are recorded.
Note:
Every event is uniquely identified by the combination of path_id and path_event_id. Thus, sorting by these two attributes ensures that rays are in a well-defined order. This enables equality comparisons between different Rays instances.
Public Static Functions Documentation¶
function concat¶
Concatenate multiple Rays instances into a singleRays instance. This is more efficient than using repeatedappend() calls.
Parameters:
rays_listA vector of Rays instances to concatenate.
Returns:
A new Rays instance containing all rays from the input instances.
Note:
Requires that all Rays instances in rays_list have the same attributes recorded.
Protected Functions Documentation¶
function Rays [1/3]¶
Private copy constructor to prevent accidental copies.
function operator=¶
Private assignment operator to prevent accidental copies.
The documentation for this class was generated from the following file Intern/rayx-core/src/Rays.h