Constrained Rectangle

For general discussion related FlowStone
Post Reply
willzz32
Posts: 20
Joined: Thu Jul 29, 2010 7:59 pm

Constrained Rectangle

Post by willzz32 »

Hi All

I'm hoping i may be able to get some help with an exe i'm trying to create. I'm trying to create a rectangle within a space that changes raito but is constrained within the space of a second rectangle. It's mainly to workout a projection canvas and then drop 16:9 projectors 'Rectangles' over the canvas.
I thought this would be easy but i can't seem to crack it, It's probably something very simple but i just can't see the solution.
Any help would be much appreciated.
Attachments
calc 2.fsm
(524.45 KiB) Downloaded 911 times
User avatar
martinvicanek
Posts: 1334
Joined: Sat Jun 22, 2013 8:28 pm

Re: Constrained Rectangle

Post by martinvicanek »

I was not sure from your schematic what your goal is so I'll try to answer your question.

Suppose you have a rectangle with sides a and b, and you want to fit it into another rectangle with sides A and B, while maintaining the aspect ratio a/b. Your scale factor is

scale = min(A/a,B/b)

so your new rectangle will have the dimensions

a' = scale*a
b' = scale*b

Does that answer your question?
willzz32
Posts: 20
Joined: Thu Jul 29, 2010 7:59 pm

Re: Constrained Rectangle

Post by willzz32 »

Thanks for pointing me in the right direction. It most definitley helps.
I'm just creating a projection calculator to help me setting up projection on shows. I know there's a few out there already but i just wanted to see if i could do my own.
I really appreciate the fast response thank you. Matt
User avatar
martinvicanek
Posts: 1334
Joined: Sat Jun 22, 2013 8:28 pm

Re: Constrained Rectangle

Post by martinvicanek »

Here is an example.
Attachments
FitImageIntoCanvas.fsm
(783.71 KiB) Downloaded 926 times
willzz32
Posts: 20
Joined: Thu Jul 29, 2010 7:59 pm

Re: Constrained Rectangle

Post by willzz32 »

Hi Martin

Thank you very much for the example.

It really helps me understand. Sorry for being a bit slow.
User avatar
pshannon
Posts: 144
Joined: Fri Jan 02, 2015 3:08 am

Re: Constrained Rectangle

Post by pshannon »

thanks Martin, however, where is the rest of the image? lol
User avatar
martinvicanek
Posts: 1334
Joined: Sat Jun 22, 2013 8:28 pm

Re: Constrained Rectangle

Post by martinvicanek »

http://www.lenna.org/full/len_full.html
Warning: may contain nudity!
User avatar
pshannon
Posts: 144
Joined: Fri Jan 02, 2015 3:08 am

Re: Constrained Rectangle

Post by pshannon »

martinvicanek wrote:http://www.lenna.org/full/len_full.html
Warning: may contain nudity!


Thanks, she is nice, but I was just playing around. Teasing us with the half image. :)
User avatar
Spogg
Posts: 3368
Joined: Thu Nov 20, 2014 4:24 pm
Location: Birmingham, England
Contact:

Re: Constrained Rectangle

Post by Spogg »

You do know that as moderators we really ought to delete porn.
But this is art, right?
Nice proper real and valid art.
And not porn, right?

Cheers

Spogg
User avatar
martinvicanek
Posts: 1334
Joined: Sat Jun 22, 2013 8:28 pm

Re: Constrained Rectangle

Post by martinvicanek »

No, not porn. Art.
I would never post porn.
Post Reply