Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/19/24 18:45
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (7th_zorro, AndrewAMD, TedMar), 837 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rating: 5
Page 1 of 2 1 2
Additional vector functions #292849
10/07/09 14:44
10/07/09 14:44
Joined: Dec 2008
Posts: 271
Saturnus Offline OP
Member
Saturnus  Offline OP
Member

Joined: Dec 2008
Posts: 271
Hello everyone,

here are some additional vector functions, that can be used with the native Gamestudio VECTORs.

The code includes:
* distance between lines/line segments
* distance between points and lines/line segments
* intersections of planes and lines/line segments
* intersections of spheres and lines/line segments
* vector projection, scalar projection

There is also a dot product function that returns a float instead of a var, in order to handle vectors with larger magnitudes. (Only drawback is, that int<->float conversion is pretty slow. Maybe somebody has a better idea?)

On a side note: The sphere-line intersection function does NOT compute the intersection points.

You can download the code here: gsvec.zip
All functions and parameters are documented in the header file.
A simple demo script (main.c) is included.
The code was tested with lite-C 1.70.1.

Perhaps somebody can make use of it.

Re: Additional vector functions [Re: Saturnus] #292966
10/08/09 08:47
10/08/09 08:47
Joined: Oct 2004
Posts: 4,134
Netherlands
Joozey Offline
Expert
Joozey  Offline
Expert

Joined: Oct 2004
Posts: 4,134
Netherlands
Awesome laugh
Had some of these functions scattered around. Assembled in one package is way handy.
Thanks!


Click and join the 3dgs irc community!
Room: #3dgs
Re: Additional vector functions [Re: Joozey] #292986
10/08/09 12:13
10/08/09 12:13
Joined: Jul 2007
Posts: 424
EUROPE
maslone1 Offline
Senior Member
maslone1  Offline
Senior Member

Joined: Jul 2007
Posts: 424
EUROPE
Realy awesome! and usefull!
thanx a lot!


A8c, Blender, FlStudio, Unity3d
Re: Additional vector functions [Re: maslone1] #293104
10/09/09 10:33
10/09/09 10:33
Joined: Dec 2008
Posts: 271
Saturnus Offline OP
Member
Saturnus  Offline OP
Member

Joined: Dec 2008
Posts: 271
Nice to hear that you find it useful!

Now it is also documented online: gsvec docs

There were a few minor bugs in the code or rather mistakes in the documentation:

* ll_vec_distSegLine(): the line is NOT defined by the first but by the second line segment
* ll_vec_distPointSeg(): does not return only 0 or 1, but also 2 and 3 (depending on the case)
* ll_vec_intersectSegPlane(): same as above

I've uploaded the corrected version of the code (same link as before).

Re: Additional vector functions [Re: Saturnus] #293170
10/09/09 18:00
10/09/09 18:00
Joined: Sep 2003
Posts: 929
Spirit Offline

Moderator
Spirit  Offline

Moderator

Joined: Sep 2003
Posts: 929
Very good. I like it!

Re: Additional vector functions [Re: Spirit] #293171
10/09/09 18:09
10/09/09 18:09
Joined: Oct 2007
Posts: 5,210
İstanbul, Turkey
Quad Offline
Senior Expert
Quad  Offline
Senior Expert

Joined: Oct 2007
Posts: 5,210
İstanbul, Turkey
great! any functions to mirror a vector along a line?


3333333333
Re: Additional vector functions [Re: Quad] #293189
10/09/09 19:53
10/09/09 19:53
Joined: Dec 2008
Posts: 271
Saturnus Offline OP
Member
Saturnus  Offline OP
Member

Joined: Dec 2008
Posts: 271
Howdy!

@Quadraxas
Do you mean something like this?
There isn't such a function yet. However, if this is what you're asking for, I can implement it of course. : )

Re: Additional vector functions [Re: Saturnus] #293201
10/09/09 21:27
10/09/09 21:27
Joined: Oct 2007
Posts: 5,210
İstanbul, Turkey
Quad Offline
Senior Expert
Quad  Offline
Senior Expert

Joined: Oct 2007
Posts: 5,210
İstanbul, Turkey
Thanks Kombucha,

yes that is what i am looking for actually. to be more preciese i would like to use a non-infinite plane to mirror a vector/position.(if thats possible of course)

Also thanks for all your contributions you ve been making lately. : )


3333333333
Re: Additional vector functions [Re: Quad] #293228
10/10/09 00:29
10/10/09 00:29
Joined: Dec 2008
Posts: 271
Saturnus Offline OP
Member
Saturnus  Offline OP
Member

Joined: Dec 2008
Posts: 271
All right, I've added a function that mirrors a position vector across a plane:
ll_vec_mirror(vector, point_on_plane, plane_normal)

This function is also featured in the demo script.
Yes, now it looks even more psychedelic. ; )

Download is up-to-date.

Quadraxas, does this function work as you expected?

I'm glad that you like these contributions!

Re: Additional vector functions [Re: Saturnus] #293256
10/10/09 07:50
10/10/09 07:50
Joined: Oct 2007
Posts: 5,210
İstanbul, Turkey
Quad Offline
Senior Expert
Quad  Offline
Senior Expert

Joined: Oct 2007
Posts: 5,210
İstanbul, Turkey
Thanks : )
yes this is exactly what i needed.

litelib is coming along nicely, eh?


3333333333
Page 1 of 2 1 2

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

Gamestudio download | chip programmers | 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