Documentation by TAPgiles

Calculator

Mathematically operates on values based on the current settings, and gives the result as an output. The face of the gadget displays the mode the calculator is in.

# Looping: When wiring from a calculator into the same calculator, the output going through that wire will be used as the input on the next frame only.

This means while using the Add operation, we can wire Result into one of the operands. Then for every frame the other operand has a value, that value is added to the result. And the result is preserved indefinitely. Turning the calculator off will reset all values, and so all sent values, and the looped received value to 0. (Tg)

This also means if we wire one operand into the other, the first will contain the current value and the second will contain the previous frame's value. This is useful for comparing the current value with the previous value, detecting a change, etc. (Tg)

# Operating on Fat Wires: Fat wires will have all values affected using the corresponding values from both operands. (Tg) (Tg)

For example, adding the wire 2 Numbers(1, 2) to 2 Numbers(3, 4) will perform (1 + 3, 2 + 4); outputting the wire 2 Numbers(4, 6).

If one operand is a fat wire value and one is a thin wire or single value, all components of the fat wire will be operated upon. (Tg)

Two Dates: When two Time/Date values are wired into the two operands, some operations will output operand A. Other operations will make the calculation between their Default Values as normal, and output a date value with the result as its default value.

Memory: Costs 0.0061% of the things limit per gadget.

# Standard Tab

# Operand 1

The first value/operand. (Tg)

When a wire is plugged in, shows the “default” value of the wire. (Tg) But will operate on the all values within the wire. (Tg)

An 8 Numbers wire will only have its first component operated on unless both values are 8 Numbers wires.

When a Time/Date is wired into either operand input its full date and time are shown.

# Standard Operation

The type of operation to perform using the values. (Jj)

  • # Add: A + B (Tg)

    Using the Blend wire-blend mode, we can add as many numbers together as we wish. (Tg)
  • # Subtract: A - B

  • # Multiply: A × B

    When using this operation on two Time/Date wires, outputs the value of the wire plugged into Operand 1.
  • # Divide: A ÷ B

    When using this operation on two Time/Date wires, outputs the value of the wire plugged into Operand 1.
  • # Greater Than: results in 1 if A is greater than B, or 0 if A is not greater than B. (Tg)

  • # Equal: results in 1 if A is the same value as B, or 0 if A is not the same value as B. (Tg)

  • # Less Than: results in 1 if A is less than B, or 0 if A is not less than B. (Tg)

  • # Remainder: Divides A into B as many whole times as possible, then outputs what’s left. (Tg)

    For example, 7 ÷ 2. 7 can be divided into 3 groups of two, leaving 1 left over. It cannot fill another group of 2 completely, so 1 is the remainder.

    Useful for finding how many times a number can go into another number completely.

    For example, if you want to find how many tens are in 112, first find the remainder 2, then subtract that from the original number 112 - 2 = 110. This new number will be perfectly divisible by 10. So divide that by 10 (110 ÷ 10 = 11). So there are 11 tens in 112.

    Using remainder after division, we can loop an input value around a specific range. (Tg)

    When using this operation on two Time/Date wires, outputs the value of the wire plugged into Operand 1.
  • # Minimum: Results in the lower of the two values. (Tg)

  • # Maximum: Results in the higher of the two values. (Tg)

  • # Power: Raises A to the power B. (Tg)

    When using this operation on two Time/Date wires, outputs the value of the wire plugged into Operand 1.

    The same as multiplying 1 by A, B times. For example 2 to the power 3 = 1 × 2 × 2 × 2 = 8.

    For a negative B, divides that many times instead. For example 2 to the power -3 = 1 ÷ 2 ÷ 2 ÷ 2 = 0.125.

  • # Round Down: Results in A rounded down to the nearest integer. (Tg)

  • # Round: Will round down A if its decimal part is lower than 0.5, or rounded up if its decimal part is higher than 0.5. (Tg)

    If the decimal part is exactly 0.5, it would round to the next integer away from 0. So 0.5 rounds to 1, and -0.5 rounds to -1.

  • # Round Up: Results in A rounded up to the nearest integer. (Tg)

  • # Absolute: If A is less than 0, the result will be more than 0 by the same amount. Otherwise, sends the same value it received. (Tg)

    For example, if A is -3, the result will be 3. If A is 5, the result will be 5.
  • # Greater Than Or Equal: Results in 1 if A is greater than or equal to B. Results in 0 if A is less than B. (Ml)

  • # Less Than Or Equal: Results in 1 if A is less than or equal to B. Results in 0 if A is greater than B. (Ml)

# Operand 2

# Result

Outputs the result of the calculation.

# Trigonometric Tab

When using these operations on Time/Date wires, outputs the value of the wire plugged into Operand 1.

# Operand A, Operand B, Result

# Trigonometric Function

Trigonometric functions describing the relationship between sides of a triangle and the angles of the corners of the triangle. (See Wikipedia for more information.)

I envision these functions as describing the relationship between a 2D point’s position and its angles. This forms a right-angled triangle by drawing a line from (0,0) to the point, down to the X axis, and back to (0,0).

In terms of traditional trigonometry labelling, the angle would be between the x-axis round to the line to the point. The horizontal line at the bottom would be known as the “adjacent,” and its length is the same as the point’s X coordinate. The vertical line on the right would be known as the “opposite,” and its length is the same as the point’s Y coordinate. The line to the point would be known as the “hypotenuse,” and its length is the same as the point’s distance from (0,0). So then the SOH-CAH-TOA memorisation technique still holds.

I’ll use the idea of a 2D point as a way of describing what the functions output.

# Radians

Angle inputs should be in radians. Angle outputs are also in radians. (Tg) 180 degrees = PI radians

So to convert: degrees × PI ÷ 180 = radians. radians × 180 ÷ PI = degrees.

  • # Sine: Results in the sine of the angle Operand A. (Tg)

    This corresponds to a 2D point’s Y ÷ distance from 0, or adjacent ÷ opposite. So if you know the distance from 0, you can multiply the result by that and get the Y.

  • # Cosine: Results in the cosine of the angle Operand A. (Tg)

    This corresponds to a 2D point’s X ÷ distance from 0, or opposite ÷ hypotenuse. So if you know the distance from 0, you can multiply the result by that and get the X.

  • # Tangent: Results in the tangent of the angle Operand A. (Tg)

    This corresponds to a 2D point’s Y ÷ X, or opposite ÷ hypotenuse. So if you know the X of the point, you can multiply the result by the X and get the Y.

  • # Arcsine: Results in the arcsine of the angle Operand A. (Tg)

    This is the inverse of the Sine function. Send it Y ÷ distance from 0, or opposite ÷ hypotenuse, and it will output the angle in radians.

  • # Arccosine: Results in the arccosine of the angle Operand A. (Tg)

    This is the inverse of the Cosine function. Send it X ÷ distance from 0, or adjacent ÷ hypotenuse, and it will output the angle in radians.

  • # Arctangent: Results in the arctangent of the angle Operand A. (Tg)

    This is the inverse of the Tangent function. Send it Y ÷ X, or opposite ÷ adjacent, and it will output the angle in radians.

  • # Two-Argument Arctangent: Results in the arctagent angle (in radians) using a 2D coordinate as defined by y or opposite = Operand A, and x or adjacent = Operand B. (Tg)

  • # Pi: Sends Pi from the Result output. This comes out at 3.141592 (using 32-bit floating point).

    To use this, make a new calculator and set it to Pi, and then wire the result into whatever other calculations you want to use Pi in.

    Alternatively, using the Adjust Properties shortcut on a slider and typing in that value will have the same effect, and save a gadget.

# Vectors Tab

A vector is a collection of multiple numbers. Normally used to define a position on a grid or graph. Or, if the distance from the (0,0) position is 1, this can be referred to as a “direction.” (Tg)

A 3D vector has 3 numbers representing the axes X, Y, and Z. These can be represented as the 3 Numbers wire type.

A 2D vector has 2 numbers. These can be represented as 2 Numbers or Left/Right Stick wire types.

# Operand A, Operand B, Result

# Vector Function

A function to apply to the vector operands.

Any operands used by these functions should be vectors. Vectors are 2 Numbers, 3 Numbers values (commonly used for positions and directions). And 4 Numbers or 8 Numbers values.

The “origin” vector for any operation would be a vector of the same type, with all components set to 0. If this were a position, it would be the “origin” of the scene.

  • # Distance Between Vectors: Results in the distance between Operand A and Operand B. (Tg)

    Equivalent to subtracting one vector from the other and finding the resulting vector’s length.

  • # Vector Length: Results in the distance between the origin and Operand A. (Tg)

  • # Normalise Vector: Results in a vector of the same type, with the values from Operand A adjusted such that its vector length would be 1. (Tg)

    For a thin-wire type, 1 is output.

    For a 0 input, a default of all-positive components is assumed.

    For example, normalising a 3 Numbers (0,0,0) will default to using (1,1,1), normalising that, and outputting the result.
  • # Vector Dot Product Normalised: Results in the dot product of the normalised Operand A and the normalised Operand B.

    Equivalent to normalising A and B before sending them in as operands to the Vector Dot Product function. (Tg)

    This means the result will be between -1 and 1, as that’s the farthest the vectors can reach from each other. (Tg)

  • # Vector Dot Product: Results in the dot product of Operand A and Operand B. (Tg)

    What is the dot product? (Tg)

    One way of thinking about what the result will be is the following: Imagine the vectors as arrows starting at 0 and pointing out. Now think of a grid plane touching the 0 point and the ends of both arrows. One arrow is the “reference” arrow, and the grid is oriented and scaled such that the x-axis starts at 0 and 1 on the x-axis is at the end of the arrow.

    This may scale the grid up or down, which also scales the result up or down. So if the reference vector has a length of 1, the result won’t be scaled at all. (Tg)

    On that grid, what X coordinate does the second vector have? That’s what the dot product is between the two vectors. Note, it could have a negative dot product if the second vector is pointing in the opposite direction, because on that graph it would be on the “left” of 0... the negative side of the graph.

    Note that it doesn’t actually matter which of the vectors you consider to be the “reference” vector; the result would be the same. Similarly, which vector you put into A and which you put into B doesn’t matter.

    Some common use cases:

    • When both vectors have a length of 1 (for example, 2 directions), the result will be 1 if they are parallel, 0 if they are prependicular to each other (90 degrees), and -1 if they are pointing in opposite directions. So you can use this to figure out how similar 2 directions are to each other.
    • When one vector has a length of 1 (for example, a direction), the result will be how far along that “arrow” the other vector travels. They may be pointing in different angles, but you’ll get the amount of the direction that the other vector moves.
  • # Angle Between Vectors: One way to understand how it gets to the angle that it outputs is: Imagine a graph oriented such that it’s flat against 0, and both of the points represented by the vectors. Then a line is drawn from the origin to Operand A, and another from the origin to Operand B.

    This outputs the angle (in degrees) at the origin between those 2 lines. (Tg)

    While this uses the (0,0,0) origin position to measure an angle from, both vectors can be translated (moved) such that a different “origin” position is used. (Tg)
  • # Vector Cross Product Normalised: Results in the cross product of A and B, but the resulting vector is then normalised. (Tg) (Tg)

    This is useful for getting the perpendicular direction without worrying about its length.

  • # Vector Cross Product: Results in the cross product of Operand A and Operand B.

    This finds a vector that is perpendicular (90 degrees) to other vectors. (Tg)

    If you only send it one vector, there are an infinite number of other vectors that are 90 degrees to it—so it will send out 0. If you send it a second vector as well, the result must be 90 degrees to both of the vectors. This narrows things down to only 2 possibilities. But which one will it pick?

    Dreams uses the “right hand rule.” (Tg)This means if you look at your right hand, stick your thumb up (that’s the first vector), point your index finger out (that’s the second vector), and point your middle finger to the left of your index finger at a 90 degree angle. The output will be a vector in the direction of your middle finger.

    If you rotated the second vector until it was on the right side of the first instead of pointing to the left, it’s like you’d need to rotate your hand 180 degrees so it matches. And so the middle finger would point away from you. Similarly, the output vector will be pointing in the opposide direction. (Tg)

    So if you look at the vectors such that the second vector points to the “left” of the first, the result will be pointing towards you. If the second vector is rotated such that it points to the “right,”” you’ve got to change perspective and look from the other side, for the result to be pointing towards you.

    The length of the vector has an interesting geometric property. Imagine a triangle drawn along one vector to the end of the arrow, across to the other vector’s arrow tip, and back down to the origin. The length of the output vector is double that. (Tg)

    So for example:

    • If the 2 vectors are parallel, there’s no room for the triangle and the output has a length of 0.
    • If the 2 vectors are perpendicular to each other you’ve got a right-angle triangle.
    • If the 2 vectors start to point in opposite directions, the triangle will get slimmer and slimmer, and so the output length will be smaller and smaller.
    • If you keep rotating the second vector and it starts being on the right side of the first vector instead of the left side, the same rule applies for the length of the output. But the vector will be pointing in the opposite direction. You could think of this as the length becoming “negative” because it’s pointing the opposite way.

# Wide Calculator

Starts with the first wired value, and operates on it with the next wired value, and so on until all available and wired operands have been used. (Ml)

Memory: Costs 0.0061% of the Things limit per gadget.

Tweak Menu

# Operation

What operation to apply to all values.

  • Add: Adds all values together.

  • Subtract: Subtracts all values from each other.

  • Divide: Divides all values by each other.

  • Multiply: Multiplies all values by each other.

  • Minimum: Results in the Minimum of all values.

  • Maximum: Results in the Maximum of all values.

# Number of Ports

How many operands will be processed.

# Operands

Wired operands to process.

# Result

The result of operating on all values.