Beispiel #1
0
def startOfStep():
  assert rigidbody2d.nextIteration() >= 1
  start_of_step_time = ( rigidbody2d.nextIteration() - 1 ) * rigidbody2d.timestep()
  if abs( 4.0 * start_of_step_time - float( int( 4.0 * start_of_step_time ) ) ) <= 1.0e-9:
    rigidbody2d.addCircleGeometry( 0.25 )
    x = 8.0 * math.sin( 2.0 * start_of_step_time )
    y = 0.0
    theta = 0.0
    vx = 0.0
    vy = 0.0
    omega = 0.0
    rho = 1.0
    geo_idx = rigidbody2d.numGeometryInstances() - 1
    fixed = 0
    rigidbody2d.addBody( x, y, theta, vx, vy, omega, rho, geo_idx, fixed )
Beispiel #2
0
def startOfStep():
    assert rigidbody2d.nextIteration() >= 1
    start_of_step_time = (rigidbody2d.nextIteration() -
                          1) * rigidbody2d.timestep()
    if abs(4.0 * start_of_step_time -
           float(int(4.0 * start_of_step_time))) <= 1.0e-9:
        rigidbody2d.addCircleGeometry(0.25)
        x = 8.0 * math.sin(2.0 * start_of_step_time)
        y = 0.0
        theta = 0.0
        vx = 0.0
        vy = 0.0
        omega = 0.0
        rho = 1.0
        geo_idx = rigidbody2d.numGeometryInstances() - 1
        fixed = 0
        rigidbody2d.addBody(x, y, theta, vx, vy, omega, rho, geo_idx, fixed)
def startOfStep():
  next_iteration = rigidbody2d.nextIteration()
  assert next_iteration >= 1
  current_iteration = next_iteration - 1
  current_time = current_iteration * rigidbody2d.timestep()
  if abs( current_time - 1.5 ) <= 1.0e-10:
    assert rigidbody2d.numStaticPlanes() == 4
    rigidbody2d.deleteStaticPlane( 3 )
def startOfStep():
  assert rigidbody2d.nextIteration() >= 1
  if ( rigidbody2d.nextIteration() - 1 ) % 25 == 0:
    if ( rigidbody2d.nextIteration() - 1 ) % 400 != 0:
      rigidbody2d.addCircleGeometry( 0.5 )
      start_of_step_time = ( rigidbody2d.nextIteration() - 1 ) * rigidbody2d.timestep()
      x = 8.0 * math.sin( 2.0 * start_of_step_time )
      y = 0.0
      theta = 0.0
      vx = 0.0
      vy = 0.0
      omega = 0.0
      rho = 1.0
      geo_idx = rigidbody2d.numGeometryInstances() - 1
      fixed = 0
      rigidbody2d.addBody( x, y, theta, vx, vy, omega, rho, geo_idx, fixed )
    else:
      assert rigidbody2d.num_bodies() == rigidbody2d.num_geometry()
      bodies_to_delete = numpy.arange( rigidbody2d.num_bodies() - 1, dtype=numpy.uint32 )
      rigidbody2d.delete_bodies( bodies_to_delete )
      rigidbody2d.delete_geometry( bodies_to_delete )
Beispiel #5
0
def startOfStep():
  next_iteration = rigidbody2d.nextIteration()
  assert next_iteration >= 1
  current_time = next_iteration * rigidbody2d.timestep()
  if current_time <= 1.0:
    nx = - math.sin( 0.5 * math.pi * current_time )
    ny = math.cos( 0.5 * math.pi * current_time )
    omega = 0.5 * math.pi
  else:
    nx = -1.0
    ny = 0.0
    omega = 0.0
  rigidbody2d.setStaticPlaneNormal( 1, nx, ny )
  rigidbody2d.setStaticPlaneAngularVelocity( 1, omega )
def startOfStep():
  next_iteration = rigidbody2d.nextIteration()
  assert next_iteration >= 1
  current_time = next_iteration * rigidbody2d.timestep()
  if current_time >= 2.0 and current_time <= 6.0:
    x_plane = 0.0
    y_plane = -2.0 - math.sin( 2.0 * math.pi * ( current_time - 2.0 ) )
    vx_plane = 0.0
    vy_plane = - 2.0 * math.pi * math.cos( 2.0 * math.pi * ( current_time - 2.0 ) )
  elif current_time >= 10.0:
    x_plane = math.sin( 2.0 * math.pi * ( current_time - 10.0 ) )
    y_plane = -2.0
    vx_plane = 2.0 * math.pi * math.cos( 2.0 * math.pi * ( current_time - 10.0 ) )
    vy_plane = 0.0
  else:
    x_plane = 0.0
    y_plane = -2.0
    vx_plane = 0.0
    vy_plane = 0.0
  rigidbody2d.setStaticPlanePosition( 0, x_plane, y_plane )
  rigidbody2d.setStaticPlaneVelocity( 0, vx_plane, vy_plane )
Beispiel #7
0
def startOfStep():
    next_iteration = rigidbody2d.nextIteration()
    assert next_iteration >= 1
    current_time = next_iteration * rigidbody2d.timestep()
    if current_time >= 2.0 and current_time <= 6.0:
        x_plane = 0.0
        y_plane = -2.0 - math.sin(2.0 * math.pi * (current_time - 2.0))
        vx_plane = 0.0
        vy_plane = -2.0 * math.pi * math.cos(2.0 * math.pi *
                                             (current_time - 2.0))
    elif current_time >= 10.0:
        x_plane = math.sin(2.0 * math.pi * (current_time - 10.0))
        y_plane = -2.0
        vx_plane = 2.0 * math.pi * math.cos(2.0 * math.pi *
                                            (current_time - 10.0))
        vy_plane = 0.0
    else:
        x_plane = 0.0
        y_plane = -2.0
        vx_plane = 0.0
        vy_plane = 0.0
    rigidbody2d.setStaticPlanePosition(0, x_plane, y_plane)
    rigidbody2d.setStaticPlaneVelocity(0, vx_plane, vy_plane)