Plot a quadrilateral having 8 points (each side passes through two points)
14 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Mohammad Javad Asgari Pirbalouti
el 18 de Abr. de 2023
Respondida: Mohammad Javad Asgari Pirbalouti
el 19 de Abr. de 2023
I have 8 points and need to plot a quadrilateral using those. Each side of it passes through two of these points, which are defined. How can I plot such a shape?
4 comentarios
Mohammad Javad Asgari Pirbalouti
el 18 de Abr. de 2023
Editada: Mohammad Javad Asgari Pirbalouti
el 18 de Abr. de 2023
John D'Errico
el 19 de Abr. de 2023
I will guess (from the vague things you have said) that you have 8 points, so pairs of two points define one side of the quadrilateral. But the points are no on a vertex. So you are hoping to find where the lines INTERSECT, and that defines the quadrilaterl? This is just a complete guess from what you have said. But you did mention having to solve equations, and that is the only thing that makes sense.
Respuesta aceptada
Más respuestas (1)
Torsten
el 18 de Abr. de 2023
Editada: Torsten
el 19 de Abr. de 2023
P1 = [0 0 0];
P2 = [1 0 0];
P3 = [0 1 0];
P4 = [0 0 1];
P5 = [1 1 0];
P6 = [0 1 1];
P7 = [1 0 1];
P8 = [1 1 1];
hold on
plot3([P1(1),P2(1)],[P1(2),P2(2)],[P1(3),P2(3)],'b')
plot3([P1(1),P3(1)],[P1(2),P3(2)],[P1(3),P3(3)],'b')
plot3([P1(1),P4(1)],[P1(2),P4(2)],[P1(3),P4(3)],'b')
plot3([P2(1),P5(1)],[P2(2),P5(2)],[P2(3),P5(3)],'b')
plot3([P2(1),P7(1)],[P2(2),P7(2)],[P2(3),P7(3)],'b')
plot3([P3(1),P5(1)],[P3(2),P5(2)],[P3(3),P5(3)],'b')
plot3([P3(1),P6(1)],[P3(2),P6(2)],[P3(3),P6(3)],'b')
plot3([P4(1),P6(1)],[P4(2),P6(2)],[P4(3),P6(3)],'b')
plot3([P4(1),P7(1)],[P4(2),P7(2)],[P4(3),P7(3)],'b')
plot3([P5(1),P8(1)],[P5(2),P8(2)],[P5(3),P8(3)],'b')
plot3([P6(1),P8(1)],[P6(2),P8(2)],[P6(3),P8(3)],'b')
plot3([P7(1),P8(1)],[P7(2),P8(2)],[P7(3),P8(3)],'b')
hold off
view([45 45])
If your quadrilateral is 2d, use "plot" instead of "plot3" in a similar way.
0 comentarios
Ver también
Categorías
Más información sobre Annotations 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!



