Skip to content

Struct rayx::Rays

ClassList > 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]

rayx::Rays::Rays () = default

function Rays [3/3]

rayx::Rays::Rays (
    Rays &&
) = default

function append

Append another Rays instance to this one.

Rays & rayx::Rays::append (
    const Rays & other
) 

Parameters:

  • other The 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.

RayAttrMask rayx::Rays::attrMask () const

Returns:

A RayAttrMask indicating the recorded attributes.


function contains

Check if a specific attribute is recorded in this Rays instance.

bool rayx::Rays::contains (
    const RayAttrMask attr
) const

Parameters:

  • attr The 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.

Rays rayx::Rays::copy () const

Returns:

A new Rays instance that is a copy of the current instance.


function count

template<typename Pred>
int rayx::Rays::count (
    Pred pred
) const

function direction [1/2]

inline glm::dvec3 rayx::Rays::direction (
    const int i
) const

function direction [2/2]

inline void rayx::Rays::direction (
    const int i,
    const glm::dvec3 direction
) 

function electric_field [1/2]

inline ElectricField rayx::Rays::electric_field (
    const int i
) const

function electric_field [2/2]

inline void rayx::Rays::electric_field (
    const int i,
    const ElectricField electric_field
) 

function empty

Check if the ray list is empty.

bool rayx::Rays::empty () const

Returns:

True if the ray list is empty, false otherwise.


function filter

template<typename Pred>
Rays rayx::Rays::filter (
    Pred pred
) const

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.

Rays & rayx::Rays::filterByAttrMask (
    const RayAttrMask mask
) 

Parameters:

  • mask A 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.

Rays rayx::Rays::filterByLastEventInPath () const

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.

Rays rayx::Rays::filterByObjectId (
    const int object_id
) const

Parameters:

  • object_id The 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).

bool rayx::Rays::isValid () const

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.

int rayx::Rays::numPaths () const

Returns:

The number of unique path IDs in the ray list.

Note:

Requires that path_id is recorded.


function operator=

Rays & rayx::Rays::operator= (
    Rays &&
) = default

function position [1/2]

inline RAYX_X_MACRO_RAY_ATTR glm::dvec3 rayx::Rays::position (
    const int i
) const

function position [2/2]

inline void rayx::Rays::position (
    const int i,
    const glm::dvec3 position
) 

function size

Get the number of events in the ray list.

int rayx::Rays::size () const

Returns:

The number of events in the ray list.


function sort

template<typename Compare>
Rays rayx::Rays::sort (
    Compare comp
) const

function sortByObjectId

Sort rays by object_id, so that rays interacting with the same object are grouped together.

Rays rayx::Rays::sortByObjectId () const

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.

Rays rayx::Rays::sortByPathIdAndPathEventId () const

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.

static Rays rayx::Rays::concat (
    const std::vector< Rays > & rays_list
) 

Parameters:

  • rays_list A 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.

rayx::Rays::Rays (
    const Rays &
) = default


function operator=

Private assignment operator to prevent accidental copies.

Rays & rayx::Rays::operator= (
    const Rays &
) = default



The documentation for this class was generated from the following file Intern/rayx-core/src/Rays.h