To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.cad.devOpen lugnet.cad.dev in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 CAD / Development / 10407
10406  |  10408
Subject: 
Re: Simple Maths Help Needed
Newsgroups: 
lugnet.cad.dev
Date: 
Sat, 4 Feb 2006 23:43:03 GMT
Viewed: 
2239 times
  
In lugnet.cad.dev, Tore Eriksson wrote:
I'm ashamed to admit, but I have got stuck in a quite simple Maths problem.
It's all about an implementation of the basic formula y=kx+m, but somehow I have
managed to think the wrong way. Luckily, I made problems like this in a glanse
back in school...

Background; I wish to create a Tweening command.
For example:
Object.Tween Object.Progress from to start_value end_value
Minifig01.LeftArm.Angle.Tween Minifig01.Progress 0 0.25 0 40
...where Minifig01.Progress is the given x value and from and to is the other x
values corresponding to start_value and end_value on the y-axis.

So, at the from value Progress=0, we read start_value=0 degrees.
When Progress reaches the end_value=0.25, we get 40 degrees.
At Progress=0.125, the angle=20 deg's.

This is very simple, I know, but I insist on doing it wrong every time!
So, I have to humble myself and ask for the formula for this quite basic
implementation.

I think what you want is:

value = start_value + ((end_value - start_value) * (Progress - from) / (to -
from))

HTH

ROSCO



Message has 1 Reply:
  Re: Simple Maths Help Needed
 
(...) Oh, how close I was, and yet... Thanks a lot, Rosco! /Tore (19 years ago, 4-Feb-06, to lugnet.cad.dev)

Message is in Reply To:
  Simple Maths Help Needed
 
I'm ashamed to admit, but I have got stuck in a quite simple Maths problem. It's all about an implementation of the basic formula y=kx+m, but somehow I have managed to think the wrong way. Luckily, I made problems like this in a glanse back in (...) (19 years ago, 4-Feb-06, to lugnet.cad.dev)

5 Messages in This Thread:

Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact

This Message and its Replies on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR