t^2
and sin(2*t)
BarChart
is a chart of data that is displayed as a set of bars representing an array of data values. Each BarChart
that is created will appear on the right side of the World View.PolyLine
object draws a series of connected lines between a given set of points. This object can be used to represent a complex path or a shape other than a circle or rectangle.Input
widget now allows you to define a limit to the maximum and minimum value that it will accept in the input as well as a step value. drawArrow
or drawLine
functions, so all your past scenarios will work. We just think, moving forward, these new objects will better represent a more generalized definition.name:value
input. This allows you to identify all the attributes with a name value pair as opposed to a list of comma separated arguments.Input
widget and the Menu
widget. These will add additional interactivity options to your simulations.Input
widget:title
:Menu
widget:title
and an array for choices
and an optional third array argument values
that represent the values corresponding to the choices
, though if you don't supply these, the choices
array is used in place of values
:opacity
: A value from 0 to 1 (default) that sets the opacity level of the object: 0 = transparent, 1 = opaque.visible
: A value of true
(default) which means the object is visible, or false
, which means the object is invisible.motion_map
: A flag (true
or false
) for activating the Motion Map for this object. motion_map
attribute is set to true
, then a motion map will be displayed for this object.motion_map
attribute set to true
, will display a maximum of 10 strobe images.degrees(angle)
: takes a radian input angle and returns the angle in degrees.radians(angle)
: takes a degree input angle and returns the angle in radians.t == 2
"distance(frame(0).puck.pos, puck.pos) == 10
"between(value, min, max)
:
This function allows you to see if a value is between a minimum value and a maximum value. It is exclusive.constrain(value, min, max)
:
This function takes a value and then constrains it to a minimum value or a maximum value. perpCW(vec)
:
This function returns a two dimensional matrix representing the clockwise perpendicular vector of the given vector.perpCCW(vec)
:
This function returns a two dimensional matrix representing the counter-clockwise perpendicular vector of the given vector.hasCollided(source, target)
:
This function takes two objects (Particle
or Block
) as its arguments and then returns true or false if the two objects are overlapping. getIntersect(source, target)
:
This function returns a two dimensional matrix representing the minimum translation vector (MTV) that would be needed to separate two objects when they overlap. This can be used to simulate collision forces based on the magnitude and direction of the MTV.myLabel = Label(position=[0, 0], size=[100, 100], “text”, “green")
You can then rotate the text as well:
myLabel.rotate(PI/4)
Particle and Block objects can also be given a text labels. This is similar to the Label object.
particle.addLabel(text="Hello", color="green")
To learn more, check out our documentation here:
https://docs.tychos.org/docs/learn/language-reference-api#label
stop(test=false)
:
Allows you to stop the simulation if a condition is met. The input can be any logical statement that can be evaluated to true or false. hasCollided(p1 = Particle, p2 = Particle)
:
This function takes two Particle objects as its arguments and then returns true or false if the two Particles are overlapping. This function only works with particles at this time, but we plan on building in more sophisticated collision detection for blocks too! getIntersect(source, target)
:
This function returns a two dimensional matrix representing the minimum translation vector (MTV) that would be needed to separate two Particle objects when they overlap. This can be used to simulate collision forces based on the magnitude and direction of the MTV.polar(radius, angle, units=”rad”)
:
This function is a utility function for quickly defining a 2d vector in polar form. It takes two required arguments, the scalar angle, and the scalar radial length. You can optionally include a tag of “deg” or “rad” to identify the angular units. The default value for units is “rad” for radians.table.setColumns(["column1", "column2", ...])
"column1"
and "column2"
would be the table column headers. You must have a table with at least one column, but you can have many more. Then you can record a new row in the table using this command in the Calculations Pane: table.addRow([val1, val2, ...])
val1
and val2
- could be any variable values you would like to record. The array of values must have the same number of values as columns in the table.
mouse.pos
This will return the mouse position within the scenario coordinate system. We have also added the ability to detect “mouse over” events. The following function allows you to test if the mouse is over a Particle or a Block: