DEV Community

Discussion on: Creating Bounding box for different code generated shapes

Collapse
 
nottesla profile image
NotTesla

If there is an iteration process during the creation of the shape, keep a record of both the greatest and least values of your x/y coordinates. These will be the bottom left and top right corners of your bounding box.

Collapse
 
svijaykoushik profile image
Vijay Koushik, S. πŸ‘¨πŸ½β€πŸ’»

Hi @nottesla ,

Thanks for your reply πŸ™‚. I think it's a good Idea to use the "greatest and least co-ordinates" for the problem. But, I still need to explore on this for shapes with curves like a heart cuz, I don't know how to calculate the greatest and least co-ordinates for a curve yet. I'll update the post When I tryout your solution.

Collapse
 
nottesla profile image
NotTesla

Ah, I see the issue now... This resource might be useful for you pomax.github.io/bezierinfo/#boundi...

Thread Thread
 
svijaykoushik profile image
Vijay Koushik, S. πŸ‘¨πŸ½β€πŸ’»

Hi @nottestla,
Thanks for your suggestionπŸ‘πŸ½, I've started reading the document and It has given me an idea to deal with the problem. And, I think I should refresh my high school maths to clearly understand the documentπŸ˜›. Thanks again!

Thread Thread
 
nottesla profile image
NotTesla

No problem, wish I could help you more. Good luck!