Main Content

read

Return target data using ray tracing

Since R2024b

    Description

    [surfaceIds,hitDistances,hitLocations,hitNormals,validHits] = read(raytraceSensor) returns data about the target detected using the ray trace sensor specified by raytraceSensor in the 3D environment.

    Input Arguments

    collapse all

    Virtual ray trace sensor that detects target in the 3D environment, specified as a sim3d.sensors.RaytraceSensor object.

    Example: raytraceSensor = sim3d.sensors.RaytraceSensor

    Output Arguments

    collapse all

    Object identifiers of the surfaces hit by the ray, returned as an integer-valued N(B+1)-by-1 vector. N is the number of rays. B is the number of bounces per ray.

    Data Types: uint8

    Ray distance to hit location, returned as a real-valued N(B+1)-by-1 vector, in meters. N is the number of rays. B is the number of bounces per ray.

    Data Types: double

    Hit locations, returned as a real-valued N(B+1)-by-3 array of the form [X, Y, Z], in meters. N is the number of rays. B is the number of bounces per ray.

    Data Types: double

    Ray normal to the hit location, returned as a real-valued N(B+1)-by-3 array of the form [X, Y, Z], in meters. N is the number of rays. B is the number of bounces per ray.

    Data Types: double

    Hit flag, returned as an N-by-1 logical vector. N is the number of rays. A value of 1 indicates the ray hit a surface.

    Data Types: Logical

    Version History

    Introduced in R2024b