# Announcing V7 of the KSP Math Library



## Big Bob (Apr 20, 2014)

Hi All,

V700 of the KSP Math Library is now available. Here's a quick summary of the new features.


* •	New Inverse Trig Functions: ArcCos, ArcSin, and ArcTan

•	Rectangular to Polar and Polar to Rectangular Conversion

•	Fast Math options for all the new functions

•	Four choices for the Angular Unit used in trig functions.
Deci-Grads	1000 divisions per right angle
Centi-Grads	10000 divisions per right angle
Deci-Degrees	900 divisions per right angle
Centi-Degrees	9000 divisions per right angle

•	In addition to the Ang90 trig constant, the library now also
provides Ang180 and Ang360. Moreover, the value of these
constants reflect the angular unit you select.

•	All the standard trig functions Sin, Cos, SinCos, and Tan
now accept any input angle in the selected angular unit.
(The former X versions of these functions have been retired)

•	The library now automatically generates its required pgs
callback handler when imported. If your application also
requires the pgs callback, a new pseudo-callback directive
on_pgs_changed is provided for easy coordination.

•	New pseudo-callback directive — on_post_init is provided
for all your application’s post-initialization needs.

•	Easier to Navigate User Guide with bookmarks and page links.*

You can view the User Guide or download the package here.

http://www.bigbobsmusicworld.com/kontak ... th-library

Rejoice,

Bob


----------



## d.healey (Apr 21, 2014)

Woohooo! Thanks Bob.


----------



## ScoringFilm (Apr 21, 2014)

Thanks Bob.


----------



## paoling (Apr 21, 2014)

Wow Bob, thanks a lot!!


----------



## gaz (Apr 21, 2014)

Most appreciated. Thanks bob!


----------



## Raptor4 (Apr 21, 2014)

God Bless You thanks a lot !


----------



## Tod (Apr 28, 2014)

Thanks Bob, I can't believe the work you've put into all this and of course I'm always amazed at what you do.

God Bless you too and Reajoice. o=<


----------



## chimuelo (Apr 29, 2014)

Man or Myth...............Bob.

Thank You So Much.


----------



## Big Bob (May 4, 2014)

My thanks to all of you for taking the time to post a thank you.

God Bless,

Bob


----------



## Mike Greene (May 4, 2014)

It's about time for me to finally start utilizing your Math Library, so the timing is perfect. Thank you for doing this, Bob!


----------



## paoling (May 9, 2014)

Just want to add that your polar<--->coords functions are GREAT!


----------



## gh (Jun 2, 2014)

Hi Big Bob!

This is an amazing tool, thank you so much.
The scripting community wouldn't be the same without you.

God bless you
Günter

PS: Would you mind to add conversion functions for the delay time in an future update?


----------



## Big Bob (Jun 2, 2014)

Thanks Günter,

Regarding the converter, are you talking about the Time knob (5 ms to 2900 ms) of the Instrument Send FX named Delay? Or is there some other delay you might be referring to?

Rejoice,

Bob


----------



## gh (Jun 2, 2014)

Hi BigBob!

Thank you for your response.
Yes, it's the delay time knob (5ms to 2900 ms) I am talking about. 

Günter


----------



## Big Bob (Jun 3, 2014)

Hi Günter,

I took a quick look at the delay time function and it looks like it can be approximated fairly well by a pure exponential with a small offset.

I'm attaching a little demo instrument that you can use to see if this is sufficiently accurate for your purposes. The new converter is named *epDlyTime*.

To check the accuracy of *epDlyTime(V2E):* Rotate the DelayTime knob and compare with the NI reported delay time.

To check the accuracy of *epDlyTime(E2V):* Rotate the EP knob and compare E2V time with the NI reported delay time.

If this is sufficiently accurate for you, I'll post the source code for *epDlyTime* which you can then add to the Math Library.

Rejoice,

Bob


----------



## gh (Jun 4, 2014)

Hi Big Bob!

Thank you and sorry for the late reply.
We have the European championship of American Football in Austria and I was busy watching the semi final.

I will test the patch tomorrow.

Thank you again
Günter


----------



## Big Bob (Jun 4, 2014)

Hi Günter,

Thanks for the email confirmation for the demo accuracy.

I will add this converter to the next release of the Math Library but I don't know when that will be.

However, in the meantime, I'm attaching an interim V700X source code module for the library which contains the new converter named *epDlyTime*. You can consult the header comments for this routine for details of how to use it.

Essentially, it converts Delay Time in msec (scaled by 100) to or from the corresponding engine parameter. Please let me know if you have any questions.

In addition, here is the source code that I used for the Demo Instrument.

*import* "KSPMathV700X.ksp"

*on init*
``message('')
``SetMathMode(0,0)
``*declare* ui_knob DlyTime (500,290000,100)
````set_knob_unit(Dlytime,KNOB_UNIT_MS)
````move_control(DlyTime,1,1)
``*declare* ui_label TimeCap (1,1)
````move_control(TimeCap,2,1)
````set_text(TimeCap,'NI reported time')
``*declare* ui_label NI_Time (1,1)
````move_control(NI_Time,2,2)
````set_text(NI_Time,' 5.0 ms')
``*declare* ui_knob EP (0,1000000,1)
````move_control(EP,3,1)
``*declare* ui_label E2Time (1,1)
````set_text(E2Time,'5.0 ms') 
````move_control(E2Time,4,2)
``*declare* ui_label E2Cap (1,1)
````move_control(E2Cap,4,1)
````set_text(E2Cap,'E2V Time')
``*declare* time
``*declare* @stime
``*declare* epx
*end* on

*on ui_control*(DlyTime)
``epx := epDlyTime(V2E,DlyTime)
``set_engine_par(ENGINE_PAR_DL_TIME,epx,-1,0,0)
``set_text(NI_Time,get_engine_par_disp(ENGINE_PAR_DL_TIME,-1,0,0) & ' ms')
*end* on

*on ui_control*(EP)
``set_engine_par(ENGINE_PAR_DL_TIME,EP,-1,0,0)
``set_text(NI_Time,get_engine_par_disp(ENGINE_PAR_DL_TIME,-1,0,0) & ' ms')
``time := epDlyTime(E2V,EP)
``stime := DFmtVal((time+5)/10,1)
``set_text(E2Time,stime & ' ms')
*end* on



Rejoice,

Bob


----------

