How do i get the largest rectangle from casting from a point to corners of a polygon?

17 Views Asked by At

I am building a shader in which I use ray casting. I am casting from one point(the light) onto the corners of a body(polygon). As this will be used for a mobile game I would like maximum performance and only want to get the outer lines(the other ones will be in between of the 2 outer ones). So to reapeat my question I would like to know which parameters I need to define which points this will be and how to do this. Thank you :) If you have any questions to my question just ask :)

1

There are 1 best solutions below

0
jay On

After drawing a little on my whiteboard(they are great for finding solutions to problems) I found out that the corners with the highest positive and negative ratio are the ones i looked for: highest and lowest deltaY:deltaY. You would go through the ratios and use max() and min() to get the 2 corners :) I hope that this will help somebody and never forget to use your whiteboard.