Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #18624 > unrolled thread

How does the algoritm look like in this scenario

Started by"Tony" <tony.johansson@inport.com>
First post2013-02-25 12:07 +0100
Last post2013-02-25 18:36 +0100
Articles 3 — 3 participants

Back to article view | Back to comp.lang.javascript


Contents

  How does the algoritm look like in this scenario "Tony" <tony.johansson@inport.com> - 2013-02-25 12:07 +0100
    Re: How does the algoritm look like in this scenario Martin Leese <please@see.Web.for.e-mail.INVALID> - 2013-02-25 10:36 -0700
    Re: How does the algoritm look like in this scenario Gregor Kofler <usenet@gregorkofler.com> - 2013-02-25 18:36 +0100

#18624 — How does the algoritm look like in this scenario

From"Tony" <tony.johansson@inport.com>
Date2013-02-25 12:07 +0100
SubjectHow does the algoritm look like in this scenario
Message-ID<kgfgj7$d9b$1@dont-email.me>
Hello!

Assume I have on the x-axes the display area from x=40 pixels to x=750 
pixels
If I now want to set a lot of point in this coordinate system.
For example if I have x-value 0 this would be positioned  at x = 40 and
x-value 800 would be positioned at x=750.
So I have to transform my x value into the coordinate system where origo for 
x is 40 and x max is 800.

I can't find a suitable algoritm that can transform my x values into this 
coordinate system.

//Tony 

[toc] | [next] | [standalone]


#18626

FromMartin Leese <please@see.Web.for.e-mail.INVALID>
Date2013-02-25 10:36 -0700
Message-ID<kgg7cq$fic$1@dont-email.me>
In reply to#18624
Tony wrote:

> Assume I have on the x-axes the display area from x=40 pixels to x=750 
> pixels
> If I now want to set a lot of point in this coordinate system.
> For example if I have x-value 0 this would be positioned  at x = 40 and
> x-value 800 would be positioned at x=750.
> So I have to transform my x value into the coordinate system where origo 
> for x is 40 and x max is 800.
> 
> I can't find a suitable algoritm that can transform my x values into 
> this coordinate system.

Well, I don't think you could have looked
very hard; it doesn't get any simpler than
this.  Try:

x' = m*x + c  where m and c are constants.

To find m and c plug in your boundary
values of x and x'.  This will give you two
equations in two unknowns, which you then
solve for m and c.

-- 
Regards,
Martin Leese
E-mail: please@see.Web.for.e-mail.INVALID
Web: http://members.tripod.com/martin_leese/

[toc] | [prev] | [next] | [standalone]


#18627

FromGregor Kofler <usenet@gregorkofler.com>
Date2013-02-25 18:36 +0100
Message-ID<kgg7d9$fkl$1@dont-email.me>
In reply to#18624
Am 2013-02-25 12:07, schrieb Tony:
> Hello!
>
> Assume I have on the x-axes the display area from x=40 pixels to x=750
> pixels
> If I now want to set a lot of point in this coordinate system.
> For example if I have x-value 0 this would be positioned  at x = 40 and
> x-value 800 would be positioned at x=750.
> So I have to transform my x value into the coordinate system where origo
> for x is 40 and x max is 800.
>
> I can't find a suitable algoritm that can transform my x values into
> this coordinate system.
>
> //Tony

xNew = xOld * (750 - 40) / 800 + 40;

Are we doing your homework, or have you been perpetually asleep in the 
basic math lessons? Or... are you just trolling?

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.javascript


csiph-web