# Smallest triangle containing point

This topic is 3419 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Easy one this, I think. Very difficult to search online for, however. Given the triangle HAB, how can I find the smallest triangle HCD that contains point FG? The image shown above is the optimal triangle HCD. Note that the slope of CD must be equal to the slope of AB. Informally, the problem is essentially "scale HAB just enough to contain FG without modifying the 'shape' of the triangle".

##### Share on other sites
It seems simple, but that makes me think I must be misunderstanding part of the problem :)

Anyway, it seems to me that the solution would go something like this:

1. Compute a normal vector perpendicular to AB.

2. Compute the perpendicular distance from H to AB.

3. Project GF onto this normal. This is the perpendicular distance from H to CD.

4. You now know the perpendicular distance from H to both AB and CD. This should give you enough information to compute C and D using some simple trig.

But again, maybe I'm missing something...

##### Share on other sites
It most likely is that simple, thanks for the description.

I don't quite understand step 3 however (why it works).

##### Share on other sites
If I'm understanding the question correctly...

1) Get vector H->FG
2) Compute angles between H->FG and H->A and H->B
3) You now have the near side of both HD(FG) and HC(FG) as well as the angle between the hypotenuse of each and the near side, which is sufficient to calculate the final lengths of hypotenuses(?) HD and HC.

EDIT: Corrected misnaming of tri sides. :-)

##### Share on other sites
I'm an idiot.

The solution was incredibly simple but I didn't see it for some reason.

Thanks very much, both of you.

##### Share on other sites
This probably doesn't add much, but the way I would have solved this is just taking the parallel to AB that passes through "FG" (a pretty bad name for a point, by the way). Its intersections with AH and BH are C and D.

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 10
• 11
• 13
• 9
• 11
• ### Forum Statistics

• Total Topics
634092
• Total Posts
3015438
×