geometry - How to check if a point (int - Coordinates) is within the hypotenuse of a triangle -
I have found a right triangle and I want to see that if any point is on Hypotenuse of that triangle, all point plain integers Are not floating-point variables
Edit: All green squares should be on the hypotenuse, not white squares. I know I want to test x, y, coordinates of the corners and coordinate of the point. All coordinates are full numbers (Y is slightly off in drawing, sorry).
This job:
If you know the triangle, then just for the hypothenuse function Create, in your example, it will be y = 5x / 12
. If you now find a point, then say x = 6, y = 3
, you can use these variables to see that it turns out right: 3 = roundup (5 * 6/12)
. If this happens, the point is on the triangle, if not - then no.
Comments
Post a Comment