Wiki
Clone wikiUFF / other_formats / USTB point
uff.point
Parameter | Type | Description |
---|---|---|
distance | double | distance from the point location to the origin of coordinates [m] |
azimuth | double | angle from the point location to the plane YZ [rad] |
elevation | double | angle from the point location to the plane XZ [rad] |
The uff.point class defines a point in a three-dimensional space in spherical coordinates. Contrary to cartersian coordinates, spherical coordinates enable us to define a point at an infinite distance but in a given direction. This feature is exploited to define plane-waves as produced by a point source at infinity.
To make the class more accesible dependent parameters are defined. The location of the point in Cartersian coordinates can be accessed as parameters 'x','y','z', and 'xyz'. For instance by
#!matlab > my_point=uff.point('distance',20e-3,'azimuth',0.5); >> my_point.xyz ans = 0.0096 0 0.0176
But these dependent variables can also be set. For instance by
#!matlab my_point=uff.point('xyz',[-10e-3 0 20e-3]); my_point.azimuth ans = -0.4636
This allows to set point locations also in Cartesian coordinates. The conversion code is available below. Some other methods allow to plot the point in a Figure.
#!matlab function h=set.x(h,in_x) assert(numel(in_x)==1, 'The x must be an scalar in [m]'); % update spherical y=h.y; z=h.z; h.distance=norm([in_x y z],2); h.azimuth=atan2(in_x,z); if(h.distance>0) h.elevation=asin(y/h.distance); else h.elevation=0; end end function h=set.y(h,in_y) assert(numel(in_y)==1, 'The y must be an scalar in [m]'); x=h.x; z=h.z; h.distance=norm([x in_y z],2); if(h.distance>0) h.elevation=asin(in_y/h.distance); else h.elevation=0; end end function h=set.z(h,in_z) assert(numel(in_z)==1, 'The z must be an scalar in [m]'); x=h.x; y=h.y; h.distance=norm([x y in_z],2); h.azimuth=atan2(x,in_z); if(h.distance>0) h.elevation=asin(y/h.distance); else h.elevation=0; end end
File Example
An example of a HDF5 file containing a uff.point data strcuture can be downloaded from here. Use any HDF5 viewer to inspect it, such as HDFView
Updated