I have a 3D reconstruction that is of the format: vertices and faces.
It was read in by an STL, or an OBJ file, and I believe the terminology of this surface format is triangulated.
This is nice to visualise using trisurf, however I need the representation of my surface to be a 2D matrix.
Specifically: I have a 3 column matrix named vertices, and another 3 column matrix named faces. They do not have the same number of rows. I want a 2D matrix, where every cell in the matrix is the height of the surface.
Is this possible? How can this be done?
I have a set of data vectors z that has this 2d plot
How would I go about embed this set of data into a 3d plot like this in matlab? I'm asking for advice and suggestions. The theory I'm trying to employ is "for each data vector~zj, “copies” the data vector intothe first two entries of a 3D data vector~yjand then computes the squared length of~zj as the third entry of~yj. " or kernel trick.
Your 2d data will somehow be in the form, that you have x-coordinates and y-coordinates. Let's say you have a vector x and a vector y for simplification.
As you found out the plot3-function proivdes functionality to plot arbitrary points in 3d without the need of generating a mesh. What you need additionally is a third vector z with data for the 3rd dimension.
So what else can you do? The thing I am thinking about is rotating the plane you are plotting you "2d" data:
Rotational matrices can be seen here:
https://en.wikipedia.org/wiki/Rotation_matrix
The Matlab function voronoi(x,y) gives the first order Voronoi diagram for the set of points $(x,y)$ e.g.
Can we use this function to draw a higher order such as 2nd order Voronoi diagram? By the order of a Voronoi diagram means the number of closest points. For example the regular Voronoi diagram is called first order because the cells have a single point that is closest to any place in the cell. A second order Voronoi diagram will have cells which are identified by the two closest points.
This previous question Higher order voronoi diagram discuss a similar problem but not in Matlab.
IMO you can use the closest pair of the sites and a dendogram and the k-order voronoi is an overlay of x k-order voronoi but without the intersecting edges.
I'm trying to create Voronoi diagrams for circles where edges are parts of hyperbola or line (special case)
My goal is to plot section of given conic between two given points.
The conic is defined by implicit function f(x,y)=0 and points are defined there
I appreciate any kind of approach, I've run out of ideas...
I have a formula that depends on theta and phi (spherical coordinates 0<=theta<=2*pi and 0<=phi<=pi). By inserting each engle, I obtained a quantity. Now I have a set of data for different angles and I need to plot the surface. My data is a 180*360 matrix, so I am not sure if I can use SURF or MESH or PLOT3. The figure should be a surface that include all data and the axes should be in terms of the quantity, not the quantity versus the angles. How can I plot such a surface?
I see no reason why you cannot use mesh or surf to plot such data. Another option I tend to use is that of density plots. You basically display the dependent variable (quantity) as an image and include the independent variables (angles) along the axis, much like you would with the aforementioned 3D plotting functions. This can be done with imagesc.
Typically you would want your axes to be the dependent variables. Could you elaborate more on this point?
If I understand you correctly you have calculated a function f(theta,phi) and now you want to plot the surface containing all the points with the polar coordinated (r,theta,phi) where r=f(theta,phi).
If this is what you want to do, the 2D version of such a plot is included in MATLAB under the name polar. Unfortunately, as you pointed out, polar3 on MatlabCentral is not the generalization you are looking for.
I have been able to plot a sphere with the following code, using constant r=1. You can give it a try with your function:
phi1=0:1/(3*pi):pi; %# this would be your 180 points
theta1=-pi:1/(3*pi):pi; % your 360 points
r=ones(numel(theta1),numel(phi1));
[phi,theta]=meshgrid(phi1,theta1);
x=r.*sin(theta).*cos(phi);
y=r.*sin(theta).*sin(phi);
z=r.*cos(theta);
tri=delaunay(x(:),y(:),z(:));
trisurf(tri,x,y,z);
From my tests it seems that delaunay also includes a lot of triangles which go through the volume of my sphere, so it seems this is not optimal. So maybe you can have a look at fill3 and construct the triangles it draws itself: as a first approximation, you could have the points [x(n,m) x(n+1,m) x(n,m+1)] combined into one triangle, and [x(n+1,m) x(n+1,m+1) x(n+1,m+1)] into another...?