name:valueinput. This allows you to identify all the attributes with a name value pair as opposed to a list of comma separated arguments.
Inputwidget and the
Menuwidget. These will add additional interactivity options to your simulations.
titleand an array for
choicesand an optional third array argument
valuesthat represent the values corresponding to the
choices, though if you don't supply these, the
choicesarray is used in place of
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 (
false) for activating the Motion Map for this object.
motion_mapattribute is set to
true, then a motion map will be displayed for this object.
motion_mapattribute 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 (
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", ...])
"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, ...])
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.posThis 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: