Dead Hackers Society
Other BBSes »
 
 

68k Inside

Sommarhack 2024

Silly Venture 2024 SE
Demoscene  Coding  CT60  Buy/sell

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]

Topic Posted by  Date 
Clipping optimisation ? Laurent / Thadoss Feb,08.2013-20:56
  Re: Clipping optimisation ? Corbo Feb,12.2013-02:53
    Re: Clipping optimisation ? Laurent / Thadoss Feb,12.2013-21:30
      Re: Clipping optimisation ? mikro Feb,13.2013-11:08
      Re: Clipping optimisation ? ggn Feb,13.2013-14:40
        Re: Clipping optimisation ? Laurent / Thadoss Feb,14.2013-10:37
          Re: Clipping optimisation ? Laurent / Thadoss Feb,14.2013-14:26


Reply to this message
Name:
Topic:
Anti-troll code:

Message:

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.
© 1994-2024 Dead Hackers Society Contact: Anders Eriksson