Borrar filtros
Borrar filtros

Writing a function IN matlab

2 visualizaciones (últimos 30 días)
SANA
SANA el 13 de Dic. de 2022
Editada: Walter Roberson el 13 de Dic. de 2022
x = newArray(3);
y = newArray(3);
getSelectionCoordinates(xx, yy);
rank = Array.rankPositions(xx);
for ( i=0; i<3; i++ ) {
x[i] = xx[rank[i]];
y[i] = yy[rank[i]];
}
/* the following code is taken from
<https://bitbucket.org/davemason/threepointcircumcircle/src> */
d1=sqrt((x[0]-x[1])*(x[0]-x[1])+(y[0]-y[1])*(y[0]-y[1]));
d2=sqrt((x[1]-x[2])*(x[1]-x[2])+(y[1]-y[2])*(y[1]-y[2]));
d3=sqrt((x[2]-x[0])*(x[2]-x[0])+(y[2]-y[0])*(y[2]-y[0]));
r=(d1*d2*d3)/sqrt((d1+d2+d3)*(d2+d3-d1)*(d3+d1-d2)*(d1+d2-d3));
print("Radius: "+d2s(r, 2));
exit();
This code i want to write this function in MATLAB, but its giving me error again and again

Respuestas (1)

Nikhil
Nikhil el 13 de Dic. de 2022
Check the below link which takes in triangle coords as input and gets its circumcircle. Hope this helps.

Categorías

Más información sobre Computational Geometry en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by