(radian, a, b)
| 71 | } |
| 72 | |
| 73 | function findIntersectionPoints(radian, a, b) { |
| 74 | if (radian < 0) { |
| 75 | radian = 0; |
| 76 | } |
| 77 | if (radian > Math.PI / 2) { |
| 78 | radian = Math.PI / 2; |
| 79 | } |
| 80 | // a is width, b is height |
| 81 | // Slope of the line |
| 82 | const m = Math.tan(radian); |
| 83 | // check if radian is close to 90 degrees |
| 84 | if (Math.abs(radian - Math.PI / 2) < 0.0001) { |
| 85 | return { x: 0, y: b }; |
| 86 | } |
| 87 | // only checks the first quadrant |
| 88 | const y = m * a; |
| 89 | if (y < b) { |
| 90 | // it intersects with the left side |
| 91 | return { x: a, y: y }; |
| 92 | } else { |
| 93 | // it intersects with the top side |
| 94 | // console.log(m); |
| 95 | const x = b / m; |
| 96 | // console.log(x, b); |
| 97 | return { x: x, y: b }; |
| 98 | } |
| 99 | } |
| 100 | |
| 101 | export function generateRectangularFaceContourPoints(a, b, segment_points) { |
| 102 | // a is width, b is height, segment_points is the number of points |
no outgoing calls
no test coverage detected