i have to draw an incircle in a triangle.
10 views (last 30 days)
i have to draw an incircle of a triangle, for that i have made an traingle... but now, how to plot an incicle in it.
p1=[2 0 0];
p2=[0 2 0];
p3=[0 0 2];
% Plot triangle using 'patch'
axis equal vis3d
Swatantra Mahato on 20 Nov 2020
Assuming you have calculated the incentre and inradius for the incircle, you can plot the incircle by using the parametric equations for a circle in 3D space and using the "plot3" function.
An example workflow is shown below (here "r" is the inradius and "in" is the vector representing the incentre)
V=[2,2,2]; %the normal to the plane of the triangle
V=V/norm(V); % unit vector for the normal
A=(p1-in)/norm(p1-in); % a unit vector on the plane passing through center of the circle
B=cross(A,V); % a vector perpendicular to A and in the plane of the triangle. A and B act as the axes
Hope this helps