viewvec() - Get Cartesian Normal Vector of Current Axis View

バージョン 1.0.0 (2.35 KB) 作成者: John Kearns
viewvec() returns the cartesian normal vector of the current axis view. Developed as the inbuilt view() mainly returns spherical angles.
ダウンロード: 4
更新 2023/7/11

ライセンスの表示

viewvec(AxHandle) returns the cartesian normal vector for the current view/camera position of AxHandle.
normVec = viewvec(AxHandle);
% Inputs: AxHandle; Handle of the target axis object.
% Uses current axis (as in gca) is no input is specified
% Outputs: normVec; % a 1x3 normal vector of current view in target axis.
This function extends the utility of MATLAB's inbuilt 'view()' function, which only returns the shperical angles (or viewing matrix) of the current camera view. While 'view()' accepts a vector as an input to define the camera position/viewing angle, it cannot output a cartesian vector of the current view.
I wrote this because, when making figures for my research, I found that plotting curves over triangulation objects (such as when highlighting the free boundary of an STL/triangulation object with a coloured plot output) can lead the edges of the triangulation to bleed into the curve. While this can often be rectified by plotting two axes over one another, that is not always feasible to do and multiple overlaid axes increases the complexity of a script. The normal vector output from 'viewvec()' facilitates easy adjustment of axis children such that they are in front of or behind other other children relative to the current view, but will appear to be in the same position relative to the current view as they were prior to adjustment.
An example is included that shows points on a surface that appear to be unmoved relative to the initial camera position.

引用

John Kearns (2024). viewvec() - Get Cartesian Normal Vector of Current Axis View (https://www.mathworks.com/matlabcentral/fileexchange/132203-viewvec-get-cartesian-normal-vector-of-current-axis-view), MATLAB Central File Exchange. 取得済み .

MATLAB リリースの互換性
作成: R2023a
すべてのリリースと互換性あり
プラットフォームの互換性
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
バージョン 公開済み リリース ノート
1.0.0