3D Vector "End Point" Calculation for procedural Vector Graphics

Posted by FrostFlame64 on Game Development See other posts from Game Development or by FrostFlame64
Published on 2012-07-09T13:58:35Z Indexed on 2012/07/09 15:25 UTC
Read the original article Hit count: 313

Alright, So I need some help with some Vector Math.

I've developing some game Engines that have Procedural Fractal Generation for Some Graphics, such as using Lindenmayer Systems for generating Trees and Plants. L-Systems, are drawn by using Turtle Graphics, which is a form of Vector graphics.

I first created a system to draw in 2D Graphics, which works perfectly fine. But now I want to make a 3D equivalent, and I’ve run into an issue.

For my 2D Version, I created a Method for quickly determining the “End Point” of a Vector-like movement. Given a starting point (X, Y), a direction (between 0 and 360 degrees), and a distance, the end point is calculated by these formulas:

newX = startX + distance * Sin((PI * direction) / 180)

newY = startY + distance * Cos((PI * direction) / 180)

Now I need something Similarly Equivalent for performing this Calculation in 3D, But I haven’t been able to Google anything that could show me how to do this.

I'm flexible enough to get whatever required information is needed for this method calculation, in any reasonable form (Vector3, Quaternion, ect).

To summarize: Given a starting point/vector position in 3D space (X, Y, Z), a Direction in 3D space (Vector3, Quaternion, ect), and a Distance, I need to find the “End Point” in 3D Space.

Thank you for your time and help.

© Game Development or respective owner

Related posts about math

Related posts about graphics