sim3d.sensors.RaytraceSensor
Description
Use the sim3d.sensors.RaytraceSensor
object to implement ray tracing in the
scene. You can configure the ray origins, directions, and lengths to adjust the ray trace
sensor pattern for your scene and test scenario. After you create a
sim3d.sensors.RaytraceSensor
object, you can modify aspects of the actor object by setting
property values.
Creation
Syntax
Description
creates a default raytraceSensor
= sim3d.sensors.RaytraceSensor()sim3d.sensors.RaytraceSensor
object in the 3D environment.
specifies options using one or more optional name-value arguments. For example, to create
a ray trace sensor with number of bounces per ray as 3, set
raytraceSensor
= sim3d.sensors.RaytraceSensor(Name=Value
)NumberOfBounces
to 3
.
Input Arguments
Specify optional pairs of arguments as
Name1=Value1,...,NameN=ValueN
, where Name
is
the argument name and Value
is the corresponding value.
Name-value arguments must appear after other arguments, but the order of the
pairs does not matter.
Example: raytraceSensor =
sim3d.sensors.RaytraceSensor(ActorName='RaytraceSensor',NumberOfBounces=3)
ActorName
— Name of actor
autogenerated name (default) | character array | string
Name of actor, specified as a character array or string. If you do not specify an actor name,
then the software assigns the actor an autogenerated name. Use
this argument to set the name of the
sim3d.sensors.RaytraceSensor
object.
Note
If you specify the same name as an actor that already exists, then the software appends actor name you specify with a unique identifier.
Translation
— Relative translation
[0,0,0]
(default) | real 1-by-3 vector
Relative translation
(x,y,z) of the actor object to its
parent actor, specified as a real 1-by-3 vector, in m. Use Translation
to
change the position of the sim3d.sensors.RaytraceSensor
object in the 3D environment along the
X, Y, and Z axes of the
coordinate system. When you add an actor to the 3D environment, the default parent actor is the
Scene Origin
at (0,0,0)
.
Example: Translation=[1 2 1]
Rotation
— Relative rotation
[0,0,0]
(default) | real 1-by-3 vector
Relative rotation (roll,
pitch, yaw) of the actor object to its parent actor,
specified as a real 1-by-3 vector, in rad. Use Rotation
to rotate the
sim3d.sensors.RaytraceSensor
object in the 3D environment.
Example: Rotation=[pi/4 pi/8 pi/2]
RayOrigins
— Ray origin
zeros(10,3)
(default) | real-valued N-by-3 array
Ray origin relative to sensor location, specified as a real-valued N-by-3 array of the form [X, Y, Z], in meters. N is the number of rays. If you mount the sensor to an actor by setting Parent
to the name of that actor, then X, Y, and Z are in the world coordinate system, where:
The X-axis points forward and away from the viewer.
The Y-axis points to the right.
The Z-axis points up.
Example: RayOrigins=zeros(10,3)
RayDirections
— Normalized ray direction
ones(10,3)
(default) | real-valued N-by-3 array
Normalized ray direction relative to sensor location, specified as a real-valued N-by-3 array of the form [X, Y, Z]. N is the number of rays. The units are dimensionless. If you mount the sensor to an actor by setting Parent
to the name of that actor, then X, Y, and Z are in the world coordinate system, where:
The X-axis points forward and away from the viewer.
The Y-axis points to the right.
The Z-axis points up.
Example: RayDirections=ones(10,3)
RayLengths
— Maximum total ray length
ones(10,1)*10
(default) | real-valued N-by-1 vector
Maximum total ray length of a multi-bounce trace path, specified as a real-valued N-by-1 vector, in meters. N is the number of rays.
Example: RayLengths=ones(10,1)*10
NumberOfBounces
— Number of bounces per ray
2
(default) | positive integer
Number of bounces per ray that a trace may have before terminating, B, specified as a positive integer.
Example: NumberOfBounces=0
VisualizeTraceLines
— Option to visualize trace lines
0
or false
(default) | 1
or true
Option to visualize trace lines, specified as 0
(false
) if the trace line visualization is not enabled or
1
(true
) if it is enabled.
Example: VisualizeTraceLines=1
EnableOptimization
— Option to enable optimization
0
or false
(default) | 1
or true
Option to enable optimization, specified as 0
(false
) if the optimization is not enabled or
1
(true
) if it is enabled. Enabling this
argument allows the object to perform concurrent traces. Enable this argument when
the number of traces is large and your machine has multiple cores.
Example: EnableOptimization=1
Properties
Parent
— Parent of actor
handle to parent actor object
Parent of actor, specified as a handle to the parent actor
object. After you add an actor to the sim3d.World
object, the default parent
actor is the Scene Origin
at (0,0,0)
. Use
Parent
to set any actor in the 3D environment as the parent actor of a
sim3d.sensors.RaytraceSensor
object.
Children
— Children of actor
structure
This property is read-only.
Children of actor, specified as a structure. Each field of the structure contains a handle to
the child of a sim3d.sensors.RaytraceSensor
object.
ParentWorld
— Parent world
handle to parent world object
Parent world, specified as a handle to the parent sim3d.World
object. You can use this property only if the sim3d.sensors.RaytraceSensor
object is
added to the parent sim3d.World
object.
SensorIdentifier
— Unique ID of sensor
real positive scalar
This property is read-only.
Unique ID of the sensor, specified as a real positive scalar.
Data Types: uint32
Translation
— Relative translation
[0,0,0]
(default) | real 1-by-3 vector
Relative translation
(x,y,z) of the actor object to its
parent actor, specified as a real 1-by-3 vector, in m. Use Translation
to
change the position of the sim3d.sensors.RaytraceSensor
object in the 3D environment along the
X, Y, and Z axes of the
coordinate system. When you add an actor to the 3D environment, the default parent actor is the
Scene Origin
at (0,0,0)
.
Example: raytraceSensor.Translation = [1 2 1]
Rotation
— Relative rotation
[0,0,0]
(default) | real 1-by-3 vector
Relative rotation (roll,
pitch, yaw) of the actor object to its parent actor,
specified as a real 1-by-3 vector, in rad. Use Rotation
to rotate the
sim3d.sensors.RaytraceSensor
object in the 3D environment.
Example: raytraceSensor.Rotation = [pi/4 pi/8 pi/2]
Mobility
— Type of actor mobility
'sim3d.utils.MobilityTypes.Static'
(default) | 'sim3d.utils.MobilityTypes.Movable'
Type of actor mobility to respond to physics, move the actor
during simulation, or both, specified as 'sim3d.utils.MobilityTypes.Movable'
or 'sim3d.utils.MobilityTypes.Static'
.
Example: raytraceSensor.Mobility =
sim3d.utils.MobilityTypes.Movable
Data Types: sim3d.utils.MobilityTypes
RayOrigins
— Ray origin
zeros(10,3)
(default) | real-valued N-by-3 array
Ray origin relative to sensor location, specified as a real-valued N-by-3 array of the form [X, Y, Z], in meters. N is the number of rays. If you mount the sensor to an actor by setting Parent
to the name of that actor, then X, Y, and Z are in the world coordinate system, where:
The X-axis points forward and away from the viewer.
The Y-axis points to the right.
The Z-axis points up.
Example: raytraceSensor.RayOrigins = zeros(10,3)
RayDirections
— Normalized ray direction
ones(10,3)
(default) | real-valued N-by-3 array
Normalized ray direction relative to sensor location, specified as a real-valued N-by-3 array of the form [X, Y, Z]. N is the number of rays. The units are dimensionless. If you mount the sensor to an actor by setting Parent
to the name of that actor, then X, Y, and Z are in the world coordinate system, where:
The X-axis points forward and away from the viewer.
The Y-axis points to the right.
The Z-axis points up.
Example: raytraceSensor.RayDirections = ones(10,3)
RayLengths
— Maximum total ray length
ones(10,1)*10
(default) | real-valued N-by-1 vector
Maximum total ray length of a multi-bounce trace path, specified as a real-valued N-by-1 vector, in meters. N is the number of rays.
Example: raytraceSensor.RayLengths = ones(10,1)*10
NumberOfBounces
— Number of bounces per ray
2
(default) | positive integer
Number of bounces per ray that a trace may have before terminating, B, specified as a positive integer.
Example: raytraceSensor.NumberOfBounces = 0
VisualizeTraceLines
— Option to visualize trace lines
0
or false
(default) | 1
or true
Option to visualize trace lines, specified as 0
(false
) if the trace line visualization is not enabled or
1
(true
) if it is enabled.
Example: raytraceSensor.VisualizeTraceLines = 1
Object Functions
read | Return target data using ray tracing |
Version History
Introduced in R2024b
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)