Difference between revisions of "How to Use Embedded Math in VTube Float Point Edit Boxes"

From ATTWiki
Jump to: navigation, search
(Constants and Functions Available in Float Point Edit Boxes)
(Symbols, Constants, and Functions)
 
(41 intermediate revisions by one user not shown)
Line 18: Line 18:
 
__TOC__
 
__TOC__
  
=The Float Point Edit Box Embedded Calculator=
+
=The Floating Point Edit Box Embedded Calculator=
As of version 3, VTube-STEP and VTube-LASER includes an embedded calculator in the float point edit boxes anywhere in the main user interface.
+
As of version 3, VTube-STEP and VTube-LASER includes an embedded calculator in the floating point edit boxes anywhere in the main user interface.
  
 
See this example of how it works.
 
See this example of how it works.
Line 76: Line 76:
 
<br>
 
<br>
  
=Constants and Functions Available in Float Point Edit Boxes=
+
=Symbols, Constants, and Functions=
  
The calculator has many built-in constants and functions. A constant is like the universal value for Pi (pronounced "Pie"). It's fixed value is 3.14... (etc.)
+
{| class="wikitable"
 +
! style="background-color:#efefef;" | Symbol
 +
!
 +
! style="background-color:#efefef;width:300px" | Description
 +
!
 +
! style="background-color:#efefef;" | Entry Example
 +
! style="background-color:#efefef;" | Result of Example Entry
 +
!
 +
|-
 +
| style="text-align: center; background-color:#dae8fc;" | +
 +
|
 +
| style="text-align: center; background-color:#ffffff;" | Add
 +
|
 +
| style="text-align: center; background-color:#9aff99;" | 1+1
 +
| style="text-align: center; background-color:#ffffff;" | 2
 +
|
 +
|-
 +
| style="text-align: center; background-color:#dae8fc;" | -
 +
|
 +
| style="text-align: center; background-color:#ffffff;" | Subtract
 +
|
 +
| style="text-align: center; background-color:#9aff99;" | 9-5
 +
| style="text-align: center; background-color:#ffffff;" | 4
 +
|
 +
|-
 +
| style="text-align: center; background-color:#dae8fc;" | *
 +
|
 +
| style="text-align: center; background-color:#ffffff;" | Multiply
 +
|
 +
| style="text-align: center; background-color:#9aff99;" | 3*6
 +
| style="text-align: center; background-color:#ffffff;" | 18
 +
|
 +
|-
 +
| style="text-align: center; background-color:#dae8fc;" | /
 +
|
 +
| style="text-align: center; background-color:#ffffff;" | Divide
 +
|
 +
| style="text-align: center; background-color:#9aff99;" | 3/8
 +
| style="text-align: center; background-color:#ffffff;" | 0.375
 +
|
 +
|-
 +
| style="text-align: center; background-color:#dae8fc;" | \
 +
|
 +
| style="text-align: center; background-color:#ffffff;" | Integer divide by
 +
|
 +
| style="text-align: center; background-color:#9aff99;" | 9/2
 +
| style="text-align: center; background-color:#ffffff;" | 4
 +
|
 +
|-
 +
| style="text-align: center; background-color:#dae8fc;" | !
 +
|
 +
| style="text-align: center; background-color:#ffffff;" | Factorial
 +
|
 +
| style="text-align: center; background-color:#9aff99;" | 5!
 +
| style="text-align: center; background-color:#ffffff;" | 120
 +
|
 +
|-
 +
| style="text-align: center; background-color:#dae8fc;" | ( )
 +
|
 +
| style="text-align: center; background-color:#ffffff;" | Nesting Parenthesis
 +
|
 +
| style="text-align: center; background-color:#9aff99;" | 2 * (5+4)
 +
| style="text-align: center; background-color:#ffffff;" | 18
 +
|
 +
|-
 +
| style="text-align: center; background-color:#dae8fc;" | mod
 +
|
 +
| style="text-align: center; background-color:#ffffff;" | Modulo (remainder)
 +
|
 +
| style="text-align: center; background-color:#9aff99;" | 7 mod 4
 +
| style="text-align: center; background-color:#ffffff;" | 3
 +
|
 +
|-
 +
| style="text-align: center; background-color:#dae8fc;" | ^
 +
|
 +
| style="text-align: center; background-color:#ffffff;" | Raised to the power of
 +
|
 +
| style="text-align: center; background-color:#9aff99;" | 4 ^ 5
 +
| style="text-align: center; background-color:#ffffff;" | 1024
 +
|
 +
|-
 +
| style="text-align: center; background-color:#dae8fc;" | Sqr
 +
|
 +
| style="text-align: center; background-color:#ffffff;" | Find the square root
 +
|
 +
| style="text-align: center; background-color:#9aff99;" | sqr(64)
 +
| style="text-align: center; background-color:#ffffff;" | 8
 +
|
 +
|-
 +
| style="text-align: center; background-color:#dae8fc;" | Int
 +
|
 +
| style="text-align: center; background-color:#ffffff;" | Truncate to an integer
 +
|
 +
| style="text-align: center; background-color:#9aff99;" | int(6.8)
 +
| style="text-align: center; background-color:#ffffff;" | 6
 +
|
 +
|-
 +
| style="text-align: center; background-color:#dae8fc;" | Frac
 +
|
 +
| style="text-align: center; background-color:#ffffff;" | Fractional part
 +
|
 +
| style="text-align: center; background-color:#9aff99;" | frac(6.8)
 +
| style="text-align: center; background-color:#ffffff;" | 0.8
 +
|
 +
|-
 +
| style="text-align: center; background-color:#dae8fc;" | Abs
 +
|
 +
| style="text-align: center; background-color:#ffffff;" | Absolute value
 +
|
 +
| style="text-align: center; background-color:#9aff99;" | abs(-8)
 +
| style="text-align: center; background-color:#ffffff;" | 8
 +
|
 +
|-
 +
| style="text-align: center; background-color:#dae8fc;" | Pi
 +
|
 +
| style="text-align: center; background-color:#ffffff;" | The constant value for Pi
 +
|
 +
| style="text-align: center; background-color:#9aff99;" | pi
 +
| style="text-align: center; background-color:#ffffff;" | 3.141592653
 +
|
 +
|-
 +
| style="text-align: center; background-color:#dae8fc;" | Cos
 +
|
 +
| style="text-align: center; background-color:#ffffff;" | Cosine
 +
|
 +
| style="text-align: center; background-color:#9aff99;" | cos(pi)
 +
| style="text-align: center; background-color:#ffffff;" | -1
 +
|
 +
|-
 +
| style="text-align: center; background-color:#dae8fc;" | Sin
 +
|
 +
| style="text-align: center; background-color:#ffffff;" | Sine
 +
|
 +
| style="text-align: center; background-color:#9aff99;" | sin(pi/2)
 +
| style="text-align: center; background-color:#ffffff;" | 1
 +
|
 +
|-
 +
| style="text-align: center; background-color:#dae8fc;" | Tan
 +
|
 +
| style="text-align: center; background-color:#ffffff;" | Tangent
 +
|
 +
| style="text-align: center; background-color:#9aff99;" | tan(1)
 +
| style="text-align: center; background-color:#ffffff;" | 1.5575
 +
|
 +
|-
 +
| style="text-align: center; background-color:#dae8fc;" | Atan
 +
|
 +
| style="text-align: center; background-color:#ffffff;" | Arc tangent
 +
|
 +
| style="text-align: center; background-color:#9aff99;" | atan(0)
 +
| style="text-align: center; background-color:#ffffff;" | 0
 +
|
 +
|-
 +
| style="text-align: center; background-color:#dae8fc;" | ArcLength
 +
|
 +
| style="text-align: center; background-color:#ffffff;" | Calculate arc length of a bend. The parameters are ANGLE, RADIUS.
 +
|
 +
| style="text-align: center; background-color:#9aff99;" | ArcLength(90,1.5)
 +
| style="text-align: center; background-color:#ffffff;" | 2.356
 +
|
 +
|-
 +
| style="text-align: center; background-color:#dae8fc;" | TriangleBaseA
 +
|
 +
| style="text-align: center; background-color:#ffffff;" | Calculate the adjacent base of a right triangle with the angle and the hypotenuse length. The parameters are ANGLE, HYPOTENUSE LENGTH.
 +
|
 +
| style="text-align: center; background-color:#9aff99;" | TriangleBaseA(5,10)
 +
| style="text-align: center; background-color:#ffffff;" | 9.961947
 +
|
 +
|-
 +
| style="text-align: center; background-color:#dae8fc;" | TriangleBaseB
 +
|
 +
| style="text-align: center; background-color:#ffffff;" | Calculate the opposing base of a right triangle with the angle and the hypotenuse length. The parameters are ANGLE, HYPOTENUSE LENGTH.
 +
|
 +
| style="text-align: center; background-color:#9aff99;" | TriangleBaseB(5,10)
 +
| style="text-align: center; background-color:#ffffff;" | 0.871557
 +
|
 +
|-
 +
| style="text-align: center; background-color:#dae8fc;" | Length2D
 +
|
 +
| style="text-align: center; background-color:#ffffff;" | Length between 2D points. The parameters are two X,Y points -like (x1,y1,x2,y2)
 +
|
 +
| style="text-align: center; background-color:#9aff99;" | Length2D(0,0,5,5)
 +
| style="text-align: center; background-color:#ffffff;" |
 +
|
 +
|-
 +
| style="text-align: center; background-color:#dae8fc;" | Length3D
 +
|
 +
| style="text-align: center; background-color:#ffffff;" | Length between 3D points. The parameters are two X,Y,Z points -like (x1,y1,z1,x2,y2,z2)
 +
|
 +
| style="text-align: center; background-color:#9aff99;" | Length3D(0,0,0,10,10,10)
 +
| style="text-align: center; background-color:#ffffff;" | 17.321
 +
|
 +
|-
 +
| style="text-align: center; background-color:#dae8fc;" | Area
 +
|
 +
| style="text-align: center; background-color:#ffffff;" | The area in a rectangle. The parameters are Length and Width - like (10,5)
 +
|
 +
| style="text-align: center; background-color:#9aff99;" | Area(10,5))
 +
| style="text-align: center; background-color:#ffffff;" | 50
 +
|
 +
|}
  
A function takes values and returns a result.  The function "Length3D(0,0,0,10,10,10)" typed into a edit box will return the 3D length between 0,0,0 and 10,10,10.  (The answer is 17.321.  Try it in any edit box.)
 
 
Here is a list of constants and functions that you can use:
 
 
<table cellpadding=10>
 
 
<tr valign=top>
 
<td width=100 bgcolor="#F0F0F0">
 
Symbol
 
</td>
 
<td width=300>
 
Description
 
</td>
 
<td width=300>
 
Example Entry in Edit Box
 
</td>
 
<td width=300>
 
Example Result in Edit Box
 
</td>
 
</tr>
 
 
 
<tr valign=top>
 
<td bgcolor="#F0F0F0">
 
+
 
</td>
 
<td>
 
Add
 
</td>
 
<td>
 
1 + 1
 
</td>
 
<td>
 
2
 
</td>
 
</tr>
 
 
<tr valign=top>
 
<td bgcolor="#F0F0F0">
 
-
 
</td>
 
<td>
 
Subtract
 
</td>
 
<td>
 
10 - 5
 
</td>
 
<td>
 
5
 
</td>
 
 
</tr>
 
 
<tr valign=top>
 
<td bgcolor="#F0F0F0">
 
<nowiki>*</nowiki>
 
</td>
 
<td>
 
Multiply
 
</td>
 
<td>
 
3 * 6
 
</td>
 
<td>
 
18
 
</td>
 
 
</tr>
 
 
<tr valign=top>
 
<td bgcolor="#F0F0F0">
 
/
 
</td>
 
<td>
 
Float Point Divide
 
</td>
 
<td>
 
3 / 8
 
</td>
 
<td>
 
0.375
 
</td>
 
</tr>
 
 
<tr valign=top>
 
<td bgcolor="#F0F0F0">
 
^
 
</td>
 
<td>
 
Raised to the power
 
</td>
 
<td>
 
4 ^ 5
 
</td>
 
<td>
 
1024
 
</td>
 
</tr>
 
 
<tr valign=top>
 
<td bgcolor="#F0F0F0">
 
Sqr
 
</td>
 
<td>
 
Square root
 
</td>
 
<td>
 
sqr(64)
 
</td>
 
<td>
 
8
 
</td>
 
 
</tr>
 
 
<tr valign=top>
 
<td bgcolor="#F0F0F0">
 
!
 
</td>
 
<td>
 
Factorial
 
</td>
 
<td>
 
5!
 
</td>
 
<td>
 
120
 
</td>
 
</tr>
 
 
 
<tr valign=top>
 
<td bgcolor="#F0F0F0">
 
Pi
 
</td>
 
<td>
 
Returns the constant value referred to as Pi
 
</td>
 
<td>
 
Pi
 
</td>
 
<td>
 
3.14159265359
 
</td>
 
 
</tr>
 
 
 
 
</table>
 
 
 
 
<br><br>
 
<br>
 
 
=STEP 2 - RADII TAB MENU=
 
 
<table width=900>
 
<tr valign=top>
 
<td width=300>
 
Enter the XYZ menu.  This is the Parametric Tube Data menu in STEP mode, and the either the MASTER TUBE or MEASURED TUBE menus in VTube-LASER mode.<br><br>
 
Click on the Radii tab menu.
 
<br><br>
 
<br><br>
 
 
</td>
 
<td width=300>
 
[[image:vtube_v2.9.10_radii_tab_menu.png|100px]]
 
</td>
 
</tr>
 
</table>
 
 
=STEP 3 - PRESS the "Resynchronize Radii to Default" BUTTON=
 
 
 
<table width=900>
 
<tr valign=top>
 
<td width=300>
 
Press the button to change all the radii.
 
</td>
 
<td width=300>
 
[[image:vts_v2.9.10_resync_radii_button.png|500px]]
 
</td>
 
</tr>
 
</table>
 
<br><br><br>
 
 
 
 
=STEP 4 - PRESS the "F2" BUTTON to REFRESH THE PARAMETRICS=
 
 
 
<table width=900>
 
<tr valign=top>
 
<td width=300>
 
Pressing F2 will refresh the parametric model and show the radius change like this.
 
</td>
 
<td width=300>
 
[[image:vts_v2.9.10_refreshF2_radiuschange.png|500px]]
 
</td>
 
</tr>
 
</table>
 
<br><br><br>
 
  
  

Latest revision as of 21:47, 10 February 2020

Vtube-step logo 2.png Vtube-laser logo 1.96.png

This article shows how to use embedded math functions in VTube float point edit boxes.

Contents


The Floating Point Edit Box Embedded Calculator

As of version 3, VTube-STEP and VTube-LASER includes an embedded calculator in the floating point edit boxes anywhere in the main user interface.

See this example of how it works.


This is the tube before the change.

Editcalc 002.png

Choose the LL value in the LRA grid.

Editcalc 001.png

Subtract 5.2 like this:

Editcalc 003.png

The VTube calculator returns the result in the edit box like this:

Editcalc 004.png

Now reverse-calc the data and this is the new tube.

Editcalc 005.png




Symbols, Constants, and Functions

Symbol Description Entry Example Result of Example Entry
+ Add 1+1 2
- Subtract 9-5 4
* Multiply 3*6 18
/ Divide 3/8 0.375
\ Integer divide by 9/2 4
 ! Factorial 5! 120
( ) Nesting Parenthesis 2 * (5+4) 18
mod Modulo (remainder) 7 mod 4 3
^ Raised to the power of 4 ^ 5 1024
Sqr Find the square root sqr(64) 8
Int Truncate to an integer int(6.8) 6
Frac Fractional part frac(6.8) 0.8
Abs Absolute value abs(-8) 8
Pi The constant value for Pi pi 3.141592653
Cos Cosine cos(pi) -1
Sin Sine sin(pi/2) 1
Tan Tangent tan(1) 1.5575
Atan Arc tangent atan(0) 0
ArcLength Calculate arc length of a bend. The parameters are ANGLE, RADIUS. ArcLength(90,1.5) 2.356
TriangleBaseA Calculate the adjacent base of a right triangle with the angle and the hypotenuse length. The parameters are ANGLE, HYPOTENUSE LENGTH. TriangleBaseA(5,10) 9.961947
TriangleBaseB Calculate the opposing base of a right triangle with the angle and the hypotenuse length. The parameters are ANGLE, HYPOTENUSE LENGTH. TriangleBaseB(5,10) 0.871557
Length2D Length between 2D points. The parameters are two X,Y points -like (x1,y1,x2,y2) Length2D(0,0,5,5)
Length3D Length between 3D points. The parameters are two X,Y,Z points -like (x1,y1,z1,x2,y2,z2) Length3D(0,0,0,10,10,10) 17.321
Area The area in a rectangle. The parameters are Length and Width - like (10,5) Area(10,5)) 50


Other Pages