Answered step by step
Verified Expert Solution
Question
1 Approved Answer
C program with user-defined functions and switch cases. Problem: Given three points (A, B, C) that will always create a triangle with a positive area,
C program with user-defined functions and switch cases.
Problem: Given three points (A, B, C) that will always create a triangle with a positive area, calculate the location of the orthocenter, circumcenter, and the location of the center of the nine point circle and whether that point is inside or outside of the triangle. How to determine whether the nine point circle center is inside or outside of the triangle? 1. Calculate the area of the three triangles created by (1) points A, B, and the nine point circle center, (2) points B, C, and the nine point circle center, and (3) points C, A, and the nine point circle center. 2. If the total of the three areas is equal to that of the triangle created by points A, B, and C, then the nine point circle center lies inside of the triangle, otherwise it lies outside of the triangle. Comparing two floating-point values for an EXACT match is prone error, for this assignment if the absolute value of the difference between the area of the larger triangle and the total area of the three smaller triangles is less than 0.001 then the values will be considered equivalent. For this assignment you will be required to implement the user-defined functions (from chapter 4). (3.2, 3.2) (3.05, 2.55) 5.-27 (2.9, 1.9) (1,1) Example Execution #1: Enter x coordinate #1 -> 1 Enter Y Coordinate #1 -> 1 Enter x coordinate #2 -> 5 Enter y coordinate #2 -> 2 Enter x coordinate #3 -> 3 Enter y coordinate #3 -> 4 Coordinates of orthocenter: 3.20, 3.20 Coordinates of circumcenter: 2.90, 1.90 The nine point circle center: 3.05, 2.55 is inside of the triangle. 4 Example Execution #2: Enter x coordinate #1 -> 3 Enter Y coordinate #1 -> 3 Enter x coordinate #2 -> -4 Enter y coordinate #2 -> -1 Enter x coordinate #3 -> 3 Enter y coordinate #3 -> 5 Coordinates of orthocenter: 6.43, -1.00 Coordinates of circumcenter: -2.21, 4.00 The nine point circle center: 2.11, 1.50 is outside of the triangle. Example Execution #3: Enter x coordinate #1 -> 4.5 Enter y coordinate #1 -> -3.5 Enter X coordinate #2 -> -6.1 Enter y coordinate #2 -> 6.5 Enter X coordinate #3 -> -5.5 Enter y coordinate #3 -> -0.5 Coordinates of orthocenter: -9.46, -4.70 Coordinates of circumcenter: 1.18, 3.60 The nine point circle center: -4.14, -0.55 is inside of the triangle. Example Execution #4: Enter x coordinate #1 -> 10.3 Enter y coordinate #1 -> -7 Enter x coordinate #2 -> 1.6 Enter y coordinate #2 -> -2.4 Enter x coordinate #3 -> 8.4 Enter y coordinate #3 -> -3.2 Coordinates of orthocenter: 11.42, 2.51 Coordinates of circumcenter: 4.44, -7.55 The nine point circle center: 7.93, -2.52 is outside of the triangleStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started