Class: MSPhysics::CurvyPiston
- Defined in:
- RubyExtension/MSPhysics/joint_curvy_piston.rb
Overview
Constant Summary collapse
- DEFAULT_ANGULAR_FRICTION =
0.0
- DEFAULT_RATE =
4.0
- DEFAULT_POWER =
0.0
- DEFAULT_ALIGNMENT_POWER =
0.0
- DEFAULT_REDUCTION_RATIO =
0.1
- DEFAULT_CONTROLLER =
nil
- DEFAULT_CONTROLLER_MODE =
0
- DEFAULT_LOOP_ENABLED =
false
- DEFAULT_ALIGNMENT_ENABLED =
true
- DEFAULT_ROTATION_ENABLED =
true
Constants inherited from Joint
Joint::DEFAULT_BODIES_COLLIDABLE, Joint::DEFAULT_BREAKING_FORCE, Joint::DEFAULT_SOLVER_MODEL, Joint::DEFAULT_STIFFNESS
Instance Method Summary collapse
-
#add_point(position) ⇒ Integer
Append point to the curve.
-
#alignment_enabled=(state) ⇒ Object
Enable/disable alignment to curve.
-
#alignment_enabled? ⇒ Boolean
Determine whether the connected body is supposed to align with the direction of curve.
-
#alignment_power ⇒ Numeric
Get alignment power.
-
#alignment_power=(value) ⇒ Object
Set alignment power.
-
#angular_friction ⇒ Numeric
Get rotational friction.
-
#angular_friction=(value) ⇒ Object
Set rotational friction.
-
#clear ⇒ Integer
Remove all points that make up the curve.
-
#controller ⇒ Numeric?
Get curvy piston controller.
-
#controller=(value) ⇒ Object
Set curvy piston controller.
-
#controller_mode ⇒ Integer
Get controller mode.
-
#controller_mode=(mode) ⇒ Object
Set controller mode.
-
#cur_acceleration ⇒ Numeric
Get current acceleration along the curve in meters per second per second.
-
#cur_normal_matrix ⇒ Geom::Transformation?
Get current normal matrix on the curve.
-
#cur_point ⇒ Geom::Point3d?
Get current point on the curve.
-
#cur_position ⇒ Numeric
Get current position along the curve in meters.
-
#cur_vector ⇒ Geom::Vector3d?
Get current vector on the curve.
-
#cur_velocity ⇒ Numeric
Get current velocity along the curve in meters per second.
-
#get_point_position(index) ⇒ Geom::Point3d?
Get point position by index.
-
#initialize(world, parent, pin_tra, group = nil) ⇒ CurvyPiston
constructor
Create a CurvyPiston joint.
-
#length ⇒ Numeric
Get curve length in meters.
-
#loop_enabled=(state) ⇒ Object
Enable/disable curve looping.
-
#loop_enabled? ⇒ Boolean
Determine whether curve looping is enabled.
-
#normal_matrices ⇒ Array<Geom::Transformation>
Get all normal matrices of the curve.
-
#normal_matrix_at_point(point) ⇒ Array<(Geom::Transformation, Numeric)>?
Get normal matrix corresponding to a particular point on or beside the curve.
-
#normal_matrix_at_position(distance) ⇒ Geom::Transformation?
Get normal matrix corresponding to a particular distance on the curve.
-
#points ⇒ Array<Geom::Point3d>
Get all points the curve is associated of.
-
#points_size ⇒ Integer
Get the number of points that make up the curve.
-
#power ⇒ Numeric
Get movement power in Watts.
-
#power=(value) ⇒ Object
Set movement power in Watts.
-
#rate ⇒ Numeric
Get maximum linear rate in meters per second.
-
#rate=(value) ⇒ Object
Set maximum linear rate in meters per second.
-
#reduction_ratio ⇒ Numeric
Get linear reduction ratio.
-
#reduction_ratio=(value) ⇒ Object
Get linear reduction ratio.
-
#remove_point(index) ⇒ Boolean
Remove point from curve at index.
-
#rotation_enabled=(state) ⇒ Object
Enable/disable rotation along the current point on curve.
-
#rotation_enabled? ⇒ Boolean
Determine whether the rotation along the current point on curve is enabled.
-
#set_point_position(index, position) ⇒ Boolean
Set point position by index.
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, #get_tension1, #get_tension2, #group, joint_by_address, #name, #name=, #parent, #set_pin_matrix, #solver_model, #solver_model=, #stiffness, #stiffness=, #type, #valid?, validate, #world
Methods inherited from Entity
Constructor Details
#initialize(world, parent, pin_tra, group = nil) ⇒ CurvyPiston
Create a CurvyPiston joint.
24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'RubyExtension/MSPhysics/joint_curvy_piston.rb', line 24 def initialize(world, parent, pin_tra, group = nil) super(world, parent, pin_tra, group) MSPhysics::Newton::CurvyPiston.create(@address) MSPhysics::Newton::CurvyPiston.set_angular_friction(@address, DEFAULT_ANGULAR_FRICTION) MSPhysics::Newton::CurvyPiston.set_rate(@address, DEFAULT_RATE) MSPhysics::Newton::CurvyPiston.set_power(@address, DEFAULT_POWER) MSPhysics::Newton::CurvyPiston.set_alignment_power(@address, DEFAULT_ALIGNMENT_POWER) MSPhysics::Newton::CurvyPiston.set_reduction_ratio(@address, DEFAULT_REDUCTION_RATIO) MSPhysics::Newton::CurvyPiston.set_controller(@address, DEFAULT_CONTROLLER) MSPhysics::Newton::CurvyPiston.set_controller_mode(@address, DEFAULT_CONTROLLER_MODE) MSPhysics::Newton::CurvyPiston.enable_loop(@address, DEFAULT_LOOP_ENABLED) MSPhysics::Newton::CurvyPiston.enable_alignment(@address, DEFAULT_ALIGNMENT_ENABLED) MSPhysics::Newton::CurvyPiston.enable_rotation(@address, DEFAULT_ROTATION_ENABLED) end |
Instance Method Details
#add_point(position) ⇒ Integer
Append point to the curve.
42 43 44 |
# File 'RubyExtension/MSPhysics/joint_curvy_piston.rb', line 42 def add_point(position) MSPhysics::Newton::CurvyPiston.add_point(@address, position) end |
#alignment_enabled=(state) ⇒ Object
Enable/disable alignment to curve.
253 254 255 |
# File 'RubyExtension/MSPhysics/joint_curvy_piston.rb', line 253 def alignment_enabled=(state) MSPhysics::Newton::CurvyPiston.enable_alignment(@address, state) end |
#alignment_enabled? ⇒ Boolean
Determine whether the connected body is supposed to align with the direction of curve.
247 248 249 |
# File 'RubyExtension/MSPhysics/joint_curvy_piston.rb', line 247 def alignment_enabled? MSPhysics::Newton::CurvyPiston.alignment_enabled?(@address) end |
#alignment_power ⇒ Numeric
Has an effect only if alignment is enabled.
Get alignment power.
260 261 262 |
# File 'RubyExtension/MSPhysics/joint_curvy_piston.rb', line 260 def alignment_power MSPhysics::Newton::CurvyPiston.get_alignment_power(@address) end |
#alignment_power=(value) ⇒ Object
Has an effect only if alignment is enabled.
Set alignment power.
268 269 270 |
# File 'RubyExtension/MSPhysics/joint_curvy_piston.rb', line 268 def alignment_power=(value) MSPhysics::Newton::CurvyPiston.set_alignment_power(@address, value) end |
#angular_friction ⇒ Numeric
Get rotational friction.
134 135 136 |
# File 'RubyExtension/MSPhysics/joint_curvy_piston.rb', line 134 def angular_friction MSPhysics::Newton::CurvyPiston.get_angular_friction(@address) end |
#angular_friction=(value) ⇒ Object
Set rotational friction.
140 141 142 |
# File 'RubyExtension/MSPhysics/joint_curvy_piston.rb', line 140 def angular_friction=(value) MSPhysics::Newton::CurvyPiston.set_angular_friction(@address, value) end |
#clear ⇒ Integer
Remove all points that make up the curve.
67 68 69 |
# File 'RubyExtension/MSPhysics/joint_curvy_piston.rb', line 67 def clear MSPhysics::Newton::CurvyPiston.clear_points(@address) end |
#controller ⇒ Numeric?
Get curvy piston controller.
201 202 203 |
# File 'RubyExtension/MSPhysics/joint_curvy_piston.rb', line 201 def controller MSPhysics::Newton::CurvyPiston.get_controller(@address) end |
#controller=(value) ⇒ Object
Set curvy piston controller.
210 211 212 |
# File 'RubyExtension/MSPhysics/joint_curvy_piston.rb', line 210 def controller=(value) MSPhysics::Newton::CurvyPiston.set_controller(@address, value) end |
#controller_mode ⇒ Integer
Get controller mode.
219 220 221 |
# File 'RubyExtension/MSPhysics/joint_curvy_piston.rb', line 219 def controller_mode MSPhysics::Newton::CurvyPiston.get_controller_mode(@address) end |
#controller_mode=(mode) ⇒ Object
Set controller mode.
228 229 230 |
# File 'RubyExtension/MSPhysics/joint_curvy_piston.rb', line 228 def controller_mode=(mode) MSPhysics::Newton::CurvyPiston.set_controller_mode(@address, mode) end |
#cur_acceleration ⇒ Numeric
Get current acceleration along the curve in meters per second per second.
107 108 109 |
# File 'RubyExtension/MSPhysics/joint_curvy_piston.rb', line 107 def cur_acceleration MSPhysics::Newton::CurvyPiston.get_cur_acceleration(@address) end |
#cur_normal_matrix ⇒ Geom::Transformation?
Get current normal matrix on the curve.
128 129 130 |
# File 'RubyExtension/MSPhysics/joint_curvy_piston.rb', line 128 def cur_normal_matrix MSPhysics::Newton::CurvyPiston.get_cur_normal_matrix(@address) end |
#cur_point ⇒ Geom::Point3d?
Get current point on the curve.
114 115 116 |
# File 'RubyExtension/MSPhysics/joint_curvy_piston.rb', line 114 def cur_point MSPhysics::Newton::CurvyPiston.get_cur_point(@address) end |
#cur_position ⇒ Numeric
Get current position along the curve in meters.
95 96 97 |
# File 'RubyExtension/MSPhysics/joint_curvy_piston.rb', line 95 def cur_position MSPhysics::Newton::CurvyPiston.get_cur_position(@address) end |
#cur_vector ⇒ Geom::Vector3d?
Get current vector on the curve.
121 122 123 |
# File 'RubyExtension/MSPhysics/joint_curvy_piston.rb', line 121 def cur_vector MSPhysics::Newton::CurvyPiston.get_cur_vector(@address) end |
#cur_velocity ⇒ Numeric
Get current velocity along the curve in meters per second.
101 102 103 |
# File 'RubyExtension/MSPhysics/joint_curvy_piston.rb', line 101 def cur_velocity MSPhysics::Newton::CurvyPiston.get_cur_velocity(@address) end |
#get_point_position(index) ⇒ Geom::Point3d?
Get point position by index.
81 82 83 |
# File 'RubyExtension/MSPhysics/joint_curvy_piston.rb', line 81 def get_point_position(index) MSPhysics::Newton::CurvyPiston.get_point_position(@address, index) end |
#length ⇒ Numeric
Get curve length in meters.
73 74 75 |
# File 'RubyExtension/MSPhysics/joint_curvy_piston.rb', line 73 def length MSPhysics::Newton::CurvyPiston.get_length(@address) end |
#loop_enabled=(state) ⇒ Object
Enable/disable curve looping.
240 241 242 |
# File 'RubyExtension/MSPhysics/joint_curvy_piston.rb', line 240 def loop_enabled=(state) MSPhysics::Newton::CurvyPiston.enable_loop(@address, state) end |
#loop_enabled? ⇒ Boolean
Determine whether curve looping is enabled.
234 235 236 |
# File 'RubyExtension/MSPhysics/joint_curvy_piston.rb', line 234 def loop_enabled? MSPhysics::Newton::CurvyPiston.loop_enabled?(@address) end |
#normal_matrices ⇒ Array<Geom::Transformation>
Get all normal matrices of the curve.
305 306 307 |
# File 'RubyExtension/MSPhysics/joint_curvy_piston.rb', line 305 def normal_matrices MSPhysics::Newton::CurvyPiston.get_normal_matrices(@address) end |
#normal_matrix_at_point(point) ⇒ Array<(Geom::Transformation, Numeric)>?
Get normal matrix corresponding to a particular point on or beside the curve.
299 300 301 |
# File 'RubyExtension/MSPhysics/joint_curvy_piston.rb', line 299 def normal_matrix_at_point(point) MSPhysics::Newton::CurvyPiston.get_normal_martix_at_point(@address, point) end |
#normal_matrix_at_position(distance) ⇒ Geom::Transformation?
Get normal matrix corresponding to a particular distance on the curve.
289 290 291 |
# File 'RubyExtension/MSPhysics/joint_curvy_piston.rb', line 289 def normal_matrix_at_position(distance) MSPhysics::Newton::CurvyPiston.get_normal_martix_at_position(@address, distance) end |
#points ⇒ Array<Geom::Point3d>
Get all points the curve is associated of.
55 56 57 |
# File 'RubyExtension/MSPhysics/joint_curvy_piston.rb', line 55 def points MSPhysics::Newton::CurvyPiston.get_points(@address) end |
#points_size ⇒ Integer
Get the number of points that make up the curve.
61 62 63 |
# File 'RubyExtension/MSPhysics/joint_curvy_piston.rb', line 61 def points_size MSPhysics::Newton::CurvyPiston.get_points_size(@address) end |
#power ⇒ Numeric
A power value of zero represents maximum power.
Get movement power in Watts.
159 160 161 |
# File 'RubyExtension/MSPhysics/joint_curvy_piston.rb', line 159 def power MSPhysics::Newton::CurvyPiston.get_power(@address) end |
#power=(value) ⇒ Object
A power value of zero represents maximum power.
Set movement power in Watts.
166 167 168 |
# File 'RubyExtension/MSPhysics/joint_curvy_piston.rb', line 166 def power=(value) MSPhysics::Newton::CurvyPiston.set_power(@address, value) end |
#rate ⇒ Numeric
Get maximum linear rate in meters per second.
146 147 148 |
# File 'RubyExtension/MSPhysics/joint_curvy_piston.rb', line 146 def rate MSPhysics::Newton::CurvyPiston.get_rate(@address) end |
#rate=(value) ⇒ Object
Set maximum linear rate in meters per second.
152 153 154 |
# File 'RubyExtension/MSPhysics/joint_curvy_piston.rb', line 152 def rate=(value) MSPhysics::Newton::CurvyPiston.set_rate(@address, value) end |
#reduction_ratio ⇒ Numeric
Reduction ratio is a feature that reduces linear rate of the joint when its current position nears its desired position. Linear reduction ratio starts acting upon the linear rate of the joint when the difference between the current position and the desired position of the joint is less than rate * reduction_ratio
meters.
A reduction ratio of zero disables the reduction feature.
A typical reduction ratio value is 0.1.
Get linear reduction ratio.
179 180 181 |
# File 'RubyExtension/MSPhysics/joint_curvy_piston.rb', line 179 def reduction_ratio MSPhysics::Newton::CurvyPiston.get_reduction_ratio(@address) end |
#reduction_ratio=(value) ⇒ Object
Reduction ratio is a feature that reduces linear rate of the joint when its current position nears its desired position. Linear reduction ratio starts acting upon the linear rate of the joint when the difference between the current position and the desired position of the joint is less than rate * reduction_ratio
meters.
A reduction ratio of zero disables the reduction feature.
A typical reduction ratio value is 0.1.
Get linear reduction ratio.
192 193 194 |
# File 'RubyExtension/MSPhysics/joint_curvy_piston.rb', line 192 def reduction_ratio=(value) MSPhysics::Newton::CurvyPiston.set_reduction_ratio(@address, value) end |
#remove_point(index) ⇒ Boolean
Remove point from curve at index.
49 50 51 |
# File 'RubyExtension/MSPhysics/joint_curvy_piston.rb', line 49 def remove_point(index) MSPhysics::Newton::CurvyPiston.remove_point(@address, index) end |
#rotation_enabled=(state) ⇒ Object
Enable/disable rotation along the current point on curve.
281 282 283 |
# File 'RubyExtension/MSPhysics/joint_curvy_piston.rb', line 281 def rotation_enabled=(state) MSPhysics::Newton::CurvyPiston.enable_rotation(@address, state) end |
#rotation_enabled? ⇒ Boolean
Determine whether the rotation along the current point on curve is enabled.
275 276 277 |
# File 'RubyExtension/MSPhysics/joint_curvy_piston.rb', line 275 def rotation_enabled? MSPhysics::Newton::CurvyPiston.rotation_enabled?(@address) end |
#set_point_position(index, position) ⇒ Boolean
Set point position by index.
89 90 91 |
# File 'RubyExtension/MSPhysics/joint_curvy_piston.rb', line 89 def set_point_position(index, position) MSPhysics::Newton::CurvyPiston.set_point_position(@address, index, position) end |