Class: MSPhysics::CurvySlider

Inherits:
Joint show all
Defined in:
RubyExtension/MSPhysics/joint_curvy_slider.rb

Overview

Since:

  • 1.0.0

Constant Summary

DEFAULT_LINEAR_FRICTION =

Since:

  • 1.0.0

0.0
DEFAULT_ANGULAR_FRICTION =

Since:

  • 1.0.0

0.0
DEFAULT_ALIGNMENT_POWER =

Since:

  • 1.0.0

0.0
DEFAULT_CONTROLLER =

Since:

  • 1.0.0

1.0
DEFAULT_LOOP_ENABLED =

Since:

  • 1.0.0

false
DEFAULT_ALIGNMENT_ENABLED =

Since:

  • 1.0.0

true
DEFAULT_ROTATION_ENABLED =

Since:

  • 1.0.0

true

Constants inherited from Joint

Joint::DEFAULT_BODIES_COLLIDABLE, Joint::DEFAULT_BREAKING_FORCE, Joint::DEFAULT_SOLVER_MODEL, Joint::DEFAULT_STIFFNESS

Instance Method Summary collapse

Methods inherited from Joint

#address, all_joints, #bodies_collidable=, #bodies_collidable?, #breaking_force, #breaking_force=, #child, #connect, #connected?, #destroy, #disconnect, #dof, #get_pin_matrix, #get_pin_matrix2, #group, joint_by_address, #name, #name=, #parent, #set_pin_matrix, #solver_model, #solver_model=, #stiffness, #stiffness=, #type, #valid?, validate, #world

Methods inherited from Entity

#inspect, #to_s

Constructor Details

#initialize(world, parent, pin_tra, group = nil) ⇒ CurvySlider

Create a CurvySlider joint.

Parameters:

  • world (MSPhysics::World)
  • parent (MSPhysics::Body, nil)
  • pin_tra (Geom::Transformation, Array<Numeric>)

    Pin transformation in global space. Matrix origin is interpreted as the pin position. Matrix Z-axis is interpreted as the pin direction.

  • group (Sketchup::Group, Sketchup::ComponentInstance, nil) (defaults to: nil)

Since:

  • 1.0.0

Instance Method Details

#add_point(position) ⇒ Fixnum

Append point to the curve.

Parameters:

  • position (Geom::Point3d)

Returns:

  • (Fixnum)

    point index.

Since:

  • 1.0.0

#alignment_enabled=(state) ⇒ Object

Enable/disable alignment to curve.

Parameters:

  • state (Boolean)

Since:

  • 1.0.0

#alignment_enabled?Boolean

Determine whether the connected body is supposed to align with the direction of curve.

Returns:

  • (Boolean)

Since:

  • 1.0.0

#alignment_powerNumeric

Note:

Has an effect only if alignment is enabled.

Get alignment power.

Returns:

  • (Numeric)

    A value greater than or equal to zero.

Since:

  • 1.0.0

#alignment_power=(value) ⇒ Object

Note:

Has an effect only if alignment is enabled.

Set alignment power.

Parameters:

  • value (Numeric)

    A value greater than or equal to zero. Pass zero to use maximum power.

Since:

  • 1.0.0

#angular_frictionNumeric

Get rotational friction.

Returns:

  • (Numeric)

    A numeric value greater than or equal to zero.

Since:

  • 1.0.0

#angular_friction=(value) ⇒ Object

Set rotational friction.

Parameters:

  • value (Numeric)

    A numeric value greater than or equal to zero.

Since:

  • 1.0.0

#clearFixnum

Remove all points that make up the curve.

Returns:

  • (Fixnum)

    The number of points removed.

Since:

  • 1.0.0

#controllerNumeric

Get magnitude of the linear and angular friction.

Returns:

  • (Numeric)

Since:

  • 1.0.0

#controller=(value) ⇒ Object

Set magnitude of the linear and angular friction.

Parameters:

  • value (Numeric)

    A numeric value greater than or equal to zero.

Since:

  • 1.0.0

#cur_accelerationNumeric

Get current acceleration along the curve in meters per second per second.

Returns:

  • (Numeric)

Since:

  • 1.0.0

#cur_normal_matrixGeom::Transformation?

Get current normal matrix on the curve.

Returns:

  • (Geom::Transformation, nil)

    A transformation in global space or nil if curve is empty or joint is disconnected.

Since:

  • 1.0.0

#cur_pointGeom::Point3d?

Get current point on the curve.

Returns:

  • (Geom::Point3d, nil)

    A point in global space or nil if curve is empty or joint is disconnected.

Since:

  • 1.0.0

#cur_positionNumeric

Get current position along the curve in meters.

Returns:

  • (Numeric)

Since:

  • 1.0.0

#cur_vectorGeom::Vector3d?

Get current vector on the curve.

Returns:

  • (Geom::Vector3d, nil)

    A vector in global space or nil if curve is empty or joint is disconnected.

Since:

  • 1.0.0

#cur_velocityNumeric

Get current velocity along the curve in meters per second.

Returns:

  • (Numeric)

Since:

  • 1.0.0

#get_point_position(index) ⇒ Geom::Point3d?

Get point position by index.

Parameters:

  • index (Fixnum)

Returns:

  • (Geom::Point3d, nil)

    Point position in global space if the index references an existing point; nil otherwise.

Since:

  • 1.0.0

#lengthNumeric

Get curve length in meters.

Returns:

  • (Numeric)

Since:

  • 1.0.0

#linear_frictionNumeric

Get movement friction.

Returns:

  • (Numeric)

    A value greater than or equal to zero.

Since:

  • 1.0.0

#linear_friction=(value) ⇒ Object

Set movement friction.

Parameters:

  • value (Numeric)

    A value greater than or equal to zero.

Since:

  • 1.0.0

#loop_enabled=(state) ⇒ Object

Enable/disable curve looping.

Parameters:

  • state (Boolean)

Since:

  • 1.0.0

#loop_enabled?Boolean

Determine whether curve looping is enabled.

Returns:

  • (Boolean)

Since:

  • 1.0.0

#normal_matricesArray<Geom::Transformation>

Get all normal matrices of the curve.

Returns:

  • (Array<Geom::Transformation>)

    An array of the normal matrices.

Since:

  • 1.0.0

#normal_matrix_at_point(point) ⇒ Array<(Geom::Transformation, Numeric)>?

Get normal matrix corresponding to a particular point on or beside the curve.

Parameters:

  • point (Geom::Point3d)

    A point in global space.

Returns:

  • (Array<(Geom::Transformation, Numeric)>, nil)

    A transformation in global space along with overpass value or nil if curve is empty or joint is disconnected.

Since:

  • 1.0.0

#normal_matrix_at_position(distance) ⇒ Geom::Transformation?

Get normal matrix corresponding to a particular distance on the curve.

Parameters:

  • distance (Numeric)

    Linear position on curve in meters.

Returns:

  • (Geom::Transformation, nil)

    A transformation in global space or nil if curve is empty or joint is disconnected.

Since:

  • 1.0.0

#pointsArray<Geom::Point3d>

Get all points the curve is associated of.

Returns:

  • (Array<Geom::Point3d>)

Since:

  • 1.0.0

#points_sizeFixnum

Get the number of points that make up the curve.

Returns:

  • (Fixnum)

Since:

  • 1.0.0

#remove_point(index) ⇒ Boolean

Remove point from curve at index.

Parameters:

  • index (Fixnum)

Returns:

  • (Boolean)

    success

Since:

  • 1.0.0

#rotation_enabled=(state) ⇒ Object

Enable/disable rotation along the current point on curve.

Parameters:

  • state (Boolean)

Since:

  • 1.0.0

#rotation_enabled?Boolean

Determine whether the rotation along the current point on curve is enabled.

Returns:

  • (Boolean)

Since:

  • 1.0.0

#set_point_position(index, position) ⇒ Boolean

Set point position by index.

Parameters:

  • index (Fixnum)
  • position (Geom::Point3d)

    Point position in global space.

Returns:

  • (Boolean)

    success

Since:

  • 1.0.0