Problem 58956. Find the nine-point circle of a triangle
Cody Problem 1336 asks us to find the circle that circumscribes a triangle, and Cody Problem 58354 asks us to find the circle that is inscribed in a triangle. This problem deals with the nine-point circle of a triangle—the circle that passes through the midpoints of the sides, the feet of the altitudes, and the midpoints of the line segments connecting the vertices to the orthocenter (the intersection of the altitudes).
Write a function that takes the x- and y-coordinates of three points describing the vertices of a triangle and returns the center and radius of the nine-point circle, as well as the x- and y-coordinates of the nine points.
Image from Wikipedia
Solution Stats
Problem Comments
-
7 Comments
Show
4 older comments
Tim
on 11 Sep 2023
The new test didn't work for me, but the following seems like it might do the trick:
[~,indx]=sort(angle(complex(x9-x0,y9-y0)));
X9=x9(indx);
Y9=y9(indx);
[~,indx]=sort(angle(complex(x9_correct-x0,y9_correct-y0)));
x9_correct=x9_correct(indx);
y9_correct=y9_correct(indx);
ChrisR
on 14 Sep 2023
OK, thanks Tim. I changed the test.
Tim
on 16 Sep 2023
Thank you.
Solution Comments
Show commentsProblem Recent Solvers3
Suggested Problems
-
3338 Solvers
-
435 Solvers
-
14 Solvers
-
105 Solvers
-
Calculate compression ratio of engine
185 Solvers
More from this Author291
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!