Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
1 registered members (TipmyPip), 18,633 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
Vector Scale #404177
07/04/12 07:14
07/04/12 07:14
Joined: Jul 2005
Posts: 187
L
lostzac Offline OP
Member
lostzac  Offline OP
Member
L

Joined: Jul 2005
Posts: 187
Anyone know the formula to where I can get the length and direction a vector has changed and apply that scale to another vector ?


John C Leutz II

Re: Vector Scale [Re: lostzac] #404183
07/04/12 09:55
07/04/12 09:55
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
What ?!?

Can you try re-explaining, especially the "apply" part?

Maybe if you explain what you want it FOR it might help...


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: Vector Scale [Re: EvilSOB] #404184
07/04/12 10:19
07/04/12 10:19
Joined: Jul 2005
Posts: 187
L
lostzac Offline OP
Member
lostzac  Offline OP
Member
L

Joined: Jul 2005
Posts: 187
Sorry...Its for a morphing system I am working on
The system takes the ref target (Non Changed model) and a Morph Target - using
vec_lerp and places the vertex's the percentage of the change....

This is working fine...

Now I want to manage multiple changes to the model...
So I need to know the lenght and direction the vertex changed from the base to the target so I can then apply those changes as well

If that makes any sense


John C Leutz II

Re: Vector Scale [Re: lostzac] #404194
07/04/12 12:54
07/04/12 12:54
Joined: Feb 2010
Posts: 320
TANA/Madagascar
3dgs_snake Offline
Senior Member
3dgs_snake  Offline
Senior Member

Joined: Feb 2010
Posts: 320
TANA/Madagascar
let A=base point coordinates
let B=target point coordinate

AB(Vector) = (B-A)
Length = magnitude(AB)

Last edited by 3dgs_snake; 07/04/12 12:55.
Re: Vector Scale [Re: 3dgs_snake] #404196
07/04/12 14:16
07/04/12 14:16
Joined: Jul 2005
Posts: 187
L
lostzac Offline OP
Member
lostzac  Offline OP
Member
L

Joined: Jul 2005
Posts: 187
Ok thanks for that next question is how to apply that to the 3rd cords....

This is what I have
Code:
VECTOR* Base;    //Base Targets
VECTOR* Target;  //Morph Target
VECTOR* Current; //The Vertex Cords currently used by the mesh
VECTOR* temp;

var percent;  //the percent to change
var a;

vec_lerp(temp,Base.x,Target.x,percent); 
vec_sub(temp.x,Base.x); //Subtracts the Current Targets by the Base
a = sqrt(sqrt(temp.x)+sqrt(temp.y)+sqrt(temp.z)); Find the Length



Now I want the Current Cords to move the Length and Direction that temp moved from Base to Target..

If i was using only one morph target Then I could of just vec_lerp and been done with it using just a base and target. but this wont work with multiple targets

So my idea was if i could figure out how far and direction the original moved from base to target, and then applied then mimicked that movement on to my Current Cords it would do the trick


John C Leutz II

Re: Vector Scale [Re: lostzac] #404197
07/04/12 15:07
07/04/12 15:07
Joined: Jul 2005
Posts: 187
L
lostzac Offline OP
Member
lostzac  Offline OP
Member
L

Joined: Jul 2005
Posts: 187
Never-mind I got it.. Thanks for the help it pointed me in the right direction, that and google, and I figured it out...I will be posting the completed version of this in a few moments, wanna run a couple of bug test for anyone else that wants it


John C Leutz II

Re: Vector Scale [Re: lostzac] #404203
07/04/12 17:37
07/04/12 17:37
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
I don't think you're calculating the length correctly. Additionally you might be interested in these functions:

http://www.conitec.net/beta/avec_lenght.htm

http://www.conitec.net/beta/avec_dist.htm


Always learn from history, to be sure you make the same mistakes again...
Re: Vector Scale [Re: Uhrwerk] #404204
07/04/12 18:52
07/04/12 18:52
Joined: Jul 2005
Posts: 187
L
lostzac Offline OP
Member
lostzac  Offline OP
Member
L

Joined: Jul 2005
Posts: 187
Isn't the magnitude of a vector sqrt(sqrt(x)+sqrt(y)+sqrt(z)) ?


John C Leutz II

Re: Vector Scale [Re: lostzac] #404205
07/04/12 18:54
07/04/12 18:54
Joined: Aug 2009
Posts: 1,438
Spain
painkiller Offline
Serious User
painkiller  Offline
Serious User

Joined: Aug 2009
Posts: 1,438
Spain
it is sqrt(x^2+y^2+z^2)

Last edited by painkiller; 07/04/12 18:54.

3D Gamestudio A8 Pro
AMD FX 8350 4.00 Ghz
16GB RAM
Gigabyte GeForce GTX 960 4GB
Re: Vector Scale [Re: painkiller] #404206
07/04/12 18:55
07/04/12 18:55
Joined: Jul 2005
Posts: 187
L
lostzac Offline OP
Member
lostzac  Offline OP
Member
L

Joined: Jul 2005
Posts: 187
Doh...slaps head..


John C Leutz II

Page 1 of 2 1 2

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1