Question for Advanced Config Coders

Discussion forum for G-Force users

Moderators: BTT, andy55, b.dwall, juxtiphi

Post Reply
User avatar
JayPro
Posts: 738
Joined: Sat May 01, 2004 10:51 pm
Location: Huntington Station, Long Island, New York

Question for Advanced Config Coders

Post by JayPro »

This is for those who actually know what certain functions that are or can be used in SS products can do mathematically.

1. What does the sqwv() function actually do? I rried his many times with flowfields but to no effect.

2. There are two "undocumented" functions: ceil() and wyvill(), the latter having ben documented before only briefly. This ceil() function I experimented with, and the engine didn't necessarily call an error on it. So could it be used at some point?

3. Is atan2 still available, or is it deprecated? I've seen it used in cartesian equations for flowfieldss, so could it be used with polar cords also?

Thanks.

PS: I'm still using the "old" coding language; the (comapartively) newer stiff I just can't wrap my noodle around. :D
"God is syntax."

jerohm
Senior Member
Posts: 419
Joined: Fri Jan 09, 2009 5:19 pm

Post by jerohm »

Mastering Flowfields requires an abstraction level above MY paygrade.
Roger Bigod is someone to aspire to.


sqvw(x) - Not exactly what "I" might think of square wave, but
returns(1) IFF x, is -1 <= x <= 1, OTHERWISE 0

ceil(x) - I ASSuME this is the compliment to floor(x),
Google("ceil equation")

wyvill(r)= -4/9r^3 + 17/9r^2 -22/9r +1
Google("Wyvill Brothers soft objects"); again, above my paygrade

depreciated usually MEANS STILL AVAILABLE, but a newer PREFERED solution exists

Google("atan2")
atan2(y,x) returns the arc tangent of the two numbers x and y.
It is SIMILAR to calculating the arc tangent of y/x, EXCEPT that the signs of both arguments
are USED TO DETERMINE THE QUADRANT of the result (see en.wikipedia.org atan2 diagram).
The result is an angle expressed in radians, -PI to PI

I don't expect this to help much, but
that's all I got folks...
:?

User avatar
DanPin
Posts: 161
Joined: Tue Mar 15, 2016 8:43 pm
Location: Los Angeles County, California

Post by DanPin »

jerohm wrote:ceil(x) - I ASSuME this is the compliment to floor(x),
Google("ceil equation")
Thanks for returning, JRM.

Hmm... anyway, I didn't discover that ceil() VectorC express. until I came across this post. To JRM, could you at least write an example waveshape that uses the ceil() function (at least containing all other expressions)? We need to make sure that this function has been implemented (otherwise it will generate the message "Error: undefined function''" if it isn't yet).

I may be also considering to have one of the following expressions added to the VectorC function table sometime in the future:
- sinh(w)
- cosh(x)
- tanh(y)
- logy(z)

jerohm
Senior Member
Posts: 419
Joined: Fri Jan 09, 2009 5:19 pm

Post by jerohm »

I think you are confused about exactly what VectorC brings to the table. I ASSuME it was implemented using the CPU's Streaming SIMD Extensions (SSE). It is somewhat analogous to implementing a software GPU paradigm... efficently executing the SAME 'function()' over a large dataset. It should have the greatest impact on FlowFields/Colorization since their dataset size is ALWAYS directly proportional to screen resolution.

With the original GForce 'language' implementation, the number of columns were (pretty much anyway) restricted to 1, a single value, or NUM_S_STEPS columns, BUT ALWAYS A SINGLE ROW. VectorC inherently deals with data stuctures in terms of any number of Columns AND Rows.

This is logically advantageous when dealing in the world of analytic geometry (read: WaveShapes). When I write code, I ASSuME the VectorC implementation produces the IDEAL solution, i.e., describing(coding) my intentions in the most efficient manner, generates the best run-time solution... which may, or may NOT be true (or even relevant as far as WaveShapes are concerned!). You may like to 'think' that an 'optimizing' compiler always works out the details in the most efficient manner(, but I am smarter than that).

Many of the original GForce 'language' functions have direct analogs with those implemented in VectorC, with the exception they are iterrated over each row. SOME of the original GForce functions still operate ONLY on a single row, and really need some attention... BUT FOR THE MOST PART, if it logically makes sense, it works the way I would expect. I could make a case, that 'Cvars' are no longer really necessary under the VectorC implementation. It would be nice, if there were a variable class that evalutes once per frame, no matter the task count.

FlowFields and WaveShapes are two very different animals. Exceptional FlowField creation requires a true mastery of trigonometry.

Code: Select all

// BORING Examples

Aspc=1
ConB=1

A0="1/&#40;NUM_S_STEPS-1&#41;"  // s-Step increment &#40;Not used here&#41;

A1="2*s -1"             // &#123; -1 ... 1 &#125;, over NUM_S_STEPS
A2="A1 * 4"             // &#123; -4 ... 4 &#125;, over NUM_S_STEPS


// REMEMBER, that variables MUST be numbered CONTIGUOUSLY, starting with 0
//  or things 'may' mysteriously stop working, without errors
//
// If you want an PERFECT 90 degree step,
//  generation of A1 is MORE complicated
//  &#40;I left that exercise for you ;0&#41;

X0="A1"
Y0="sqwv&#40;A2&#41;"

// X1="A1"              // UNCOMMENT for display
// Y1="floor&#40;A2&#41;/4"     // UNCOMMENT for display

// X2="A1"              // UNCOMMENT for display
// Y2="ceil&#40;A2&#41;/4"      // UNCOMMENT for display

Vers=500

Google("Floor and ceiling functions - IPFS")


I will be out of the US for a couple of weeks...
you are on your own
later

Post Reply