Akzeptierte Antwort

Dr. Seis
Dr. Seis am 14 Jun. 2012

2 Stimmen

How about polyarea?
>> x = [0, 0, 4];
>> y = [0, 3, 0];
>> area1 = polyarea(x,y)
area1 =
6
>> area2 = 0.5*3*4
area2 =
6

5 Kommentare

Luffy
Luffy am 20 Jun. 2012
But how do you find area of a triangle in 3-D,the above command only gives 2D area
Walter Roberson
Walter Roberson am 20 Jun. 2012
Triangles only _have_ 2D area.
Perhaps you are asking about finding the area of a triangle when the coordinates are specified in 3D ?
Luffy
Luffy am 22 Jun. 2012
My mistake in writing 2D area, i meant what if u have coordinates in 3D.
Example:- area of triangle with coordinates as (1,0,0)(0,1,0)(0,0,1) without using heron's algorithm
Dr. Seis
Dr. Seis am 22 Jun. 2012
I think you would have to do some sort of coordinate transform (to still use the "polyarea" function above), such that all the coordinate values for one of the dimensions (e.g., the z-coordinate) are 0. But it seems using Heron's algorithm would be much easier.
SaN AruL
SaN AruL am 25 Nov. 2016
Verschoben: DGM am 21 Feb. 2023
thank you Dr. Seis..........

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

AYUSH MISHRA
AYUSH MISHRA am 26 Mai 2020

0 Stimmen

function area=tri_area(b,h,n)
area=0.5*b*h*n;
end
%Here b=base of triangle , h=height of triangle , n=number of triangle
Example
area= tri_area(2,3,5)
area =
15

Kategorien

Mehr zu Computational Geometry finden Sie in Hilfe-Center und File Exchange

Tags

Gefragt:

am 14 Jun. 2012

Verschoben:

DGM
am 21 Feb. 2023

Community Treasure Hunt

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

Start Hunting!

Translated by