|
Atari coding BBS
Clipping optimisation ? |
Posted by: Laurent / Thadoss
|
Feb,08.2013-20:56
|
Hi all,
I've got a little question about clipping and optimisation :
Let's say I have 2 "points" like this
Y1 is a height and W1 is a width associated
Y2 is a height and W2 is a width associated
Y1 is always > to Y2
Let's give values for the example :
Y1=260, W1=120
Y2=210, W2=20
If Y1 > 240, I'd like to compute the value of W for Y1 = 240
My actual thought drive me to a line equation like this :
; Clip Width for Y = 240
delta = (y2-y1) / (x2-x1)
b = Y2 - W2*delta
Wclip = (Yclip - b) / delta
With this, I can compute delta and b and then, Wclip (Yclip = 240)
But it looks awfully slow, no ?
Is there a known algo or a better way to optimize this ?
Regards
Laurent / Thadoss
|
[All messages in this thread] [Start new thread]
What's the anti-troll code? That's your personal code to be able to add comments and messages on the dhs.nu site.
Don't have a code or forgot it? Fix it here.
|