Matlab: how to plot 3D text ( not 2D as function text does) - matlab

I know it is not a trivial task however I was wondering if anyone has already done this:
the text(x,y,z,'text') function plots a 2d text attached to the coordinate system of the 2d figure. What I need is a 3D text as a 3D entity which changes in accordance with the camera view.
Or if there is a way to extract the 2D data (x,y) of a 2D text and transform it ( rotate + translate) in 3D coordinate system.
Thanks a lot in advance
PS. I only have matlab basic version, with no toolbox in it.

You should be looking for [1].
1. http://www.mathworks.com/help/toolbox/mupad/plot/PRIMITIV_Text3d.html

Related

How to get the X,Y,Z coordinates of a 3D object in matlab?

I am working on a 3D object. My main goal is to click on the 3D object and save the X,Y,Z co-ordinates. I tried few programs, but most of them need the datacursormode and then collect the co-ordinates using getCursorInfo. Is there any other way through which i can achieve my goal without using these? Thank you.

Find dimensions of object in 3D

I have a irregular shaped round object(blue) in 3D that lies on a straight plane(purple).
The object consists of a 3xn matrix which contains its x, y and z-coordinates. The plane is constructed using 2 vectors and a point it passes through.
I want to know the perimeter and cross-sectional the object encloses. I know how to obtain these dimensions in binary 2D images using the regionprops function from the image processing toolbox, but I don't know how to do this for 3D objects. Can anybody help me? Thank you very much!
I've solved the problem by creating a new 2D coordinate system. Thereafter I used drawPolyline to create a polyline and calculate the area using polyarea.

Generate 3D surface from scattered or data points

Can anyone tell me how to generate a 3D surface model like CAD in Matlab ?
1.Input: Input is a collection of points with (x,y,z) where surface is present for an object(I'm using this for a 3D scanner where my inputs are (x,y,z) of surface)
2.Points should be displayed as a surface using some smooth interpolation.
3.More like surface generation from data points.
Thanks you.
In order to plot surfaces, you can use patch function. However, you need along with the points the faces information. In patch a surface consists of polygons that is specified using 3 point, which is the face information.
1
Since it seems like you will be inputting discrete points located on the surface of the object, you will first want to create a Nonconvex Polygon based on the data using Matlab's boundary function.
https://www.mathworks.com/help/matlab/ref/boundary.html
You can then use the trimesh function to create the figure
This question shows the input data and what was produced using this method: How do I create a 3D polygon/mesh over data points?

overlaying location map (coastline) on slice plots in MatLab?

I made plots of depth slices using function slice, with each slice showing earth's velocity distribution. I am having a hard time overlaying the location map (coastline) on the figure. Does anyone know if this is possible with MatLab? OR Can you overlay any x,y(and z) plot on slice image?
Thanks all! I figured it out. Had to import coastline data from some online database and used hold on/off to overlay, with plot3. My original plan of using the mapping tools on MatLab didn't work.

How to texture map to a rotated surface in matlab?

I would like to texture map a 2D image to a 3D surface. I would like to do it in GUI so the user can rotate/shift/zoom the surface with the camera toolbar and then the image will be mapped to the visible portion of the surface.
I know I can get the camera position with campos command, but how do I get the camera orientation?
Any idea? Or maybe you can suggest a better approach?
Thanks!
To answer the question from your title (from what I understand), you can assign a texture map to 3D data using the accurately named texturemap value of the FaceColor property (original right?) as well as the appropriate CData (here a 2D image).
Simple example:
clear
clc
A = imread('peppers.png');
%// Generate dummy surface plot
[X,Y] = meshgrid([-2:.25:2]);
Z = X.*exp(-X.^2 -Y.^2);
surf(X,Y,Z,'CData',A,'FaceColor','texturemap')
It looks like this:
By default in a figure window you can zoom/move around as you want. For the 2nd part of your question, I think you should carefully read the docs for campos and related functions to get/set the camera position. Since building a GUI to perform that task requires much effort I think your best bet would be to try something on your own and ask questions about it here if you are stuck somewhere.
Hope that helps!