Raised This Month: $ Target: $400
 0% 

Extend Line and get it's origin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
shine771
Senior Member
Join Date: Jun 2007
Old 03-03-2009 , 12:11   Extend Line and get it's origin
Reply With Quote #1

I have 2 origins, i created a beam between them(line). I want to extend the line, and get it's end origin. Example image:
[IMG]http://img91.**************/img91/6706/imgm.jpg[/IMG]
The black dots are origins i have. The red dot is the origin what i need. I want to know the formula or a function how to do this.

Thanks.
shine771 is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 03-03-2009 , 12:21   Re: Extend Line and get it's origin
Reply With Quote #2

Code:
// this goes from origin1 to origin2 and extended to origin3 new Float:origin1[3]; // fill your 1st origin new Float:origin2[3]; // fill your 2nd origin new Float:vector[3]; xs_vec_sub(origin2, origin1, vector); new Float:length = xs_vec_len(vector); xs_vec_normalize(vector); new Float:extended; // set extended to your extra distance to find origin 3 xs_vec_mul_scalar(vector, length + extended, vector); new Float:origin3[3]; xs_vec_add(origin1, vector, origin3); // origin3 holds the extended line end point
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
shine771
Senior Member
Join Date: Jun 2007
Old 03-03-2009 , 13:03   Re: Extend Line and get it's origin
Reply With Quote #3

Big thanks!
shine771 is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 16:53.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode