How do I incorporate multiple values of the Z-coordinate into my calculation of projection area?
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello, I have a matrix A that consists of the coordinates of the 8 corners of 3 cubes, for a total of 24 points. I first import these coordinates in X,Y,Z matrices and then I want to plot and calculate the area of the projection on the X-Z plane. However, due to overlapping X and Y coordinates, half of the Z values are ignored. How do I incorporate multiple values of Z into my calculation of projection area?
clear all
close all
clc
A=[-100 -40 50
-100 -40 5
-80 -40 50
-80 -40 5
-100 5 5
-100 5 50
-80 5 50
-80 5 5
-100 0 50
-100 0 5
20 0 5
20 0 50
-100 50 5
-100 50 5
20 50 50
20 50 5
-30 70 50
-30 70 5
5 70 5
5 70 50
-30 120 50
-30 120 5
5 120 50
5 120 5]; %3 cubes Coordinate Matrix
[X,Y] = meshgrid(-150:1:150,-150:1:150);
Z=zeros(size(X,1),size(X,2));
for i=1:length(A)
[p,j]=find(X==A(i,1));
[k,l]=find(Y==A(i,2));
Z(k(1),j(1))=A(i,3);
end
plot(X(1,:),max(Z))
hold on
plot(X(1,:),min(Z),'r')
polyarea(X(1,:),max(Z))
The above is the code I am using
0 commentaires
Réponses (0)
Voir également
Catégories
En savoir plus sur Splines dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!