예제 #1
0
void PlanarPortal::teleportPoint( const Vector2s& xin, const bool intersecting_plane_idx, Vector2s& xout ) const
{
  // Plane A -> Plane B
  if( !intersecting_plane_idx )
  {
    teleportPointThroughPlaneA( xin, xout );
  }
  // Plane B -> Plane A
  else
  {
    teleportPointThroughPlaneB( xin, xout );
  }
}
예제 #2
0
void PlanarPortal::teleportBall( const Vector2s& xin, const scalar& r, Vector2s& xout ) const
{
  assert( m_plane_a.distanceLessThanOrEqualZero( xin, r ) != m_plane_b.distanceLessThanOrEqualZero( xin, r ) );

  // Teleporting form A to B
  if( m_plane_a.distanceLessThanOrEqualZero( xin, r ) )
  {
    teleportPointThroughPlaneA( xin, xout );
  }
  // Teleporting form B to A
  else
  {
    teleportPointThroughPlaneB( xin, xout );
  }
}
예제 #3
0
void PlanarPortal::teleportPointInsidePortal( const Vector2s& xin, Vector2s& xout ) const
{
  assert( planeA().distanceLessThanZero( xin ) != planeB().distanceLessThanZero( xin ) );

  // Teleporting form A to B
  if( planeA().distanceLessThanZero( xin ) )
  {
    teleportPointThroughPlaneA( xin, xout );
  }
  // Teleporting form B to A
  else
  {
    teleportPointThroughPlaneB( xin, xout );
  }
}
예제 #4
0
void PlanarPortal::teleportBall( const Vector2s& xin, const scalar& r, Vector2s& xout ) const
{
  assert( ballInPlaneA( xin, r ) != ballInPlaneB( xin, r ) );

  // Teleporting form A to B
  if( ballInPlaneA( xin, r ) )
  {
    teleportPointThroughPlaneA( xin, xout );
  }
  // Teleporting form B to A
  else
  {
    teleportPointThroughPlaneB( xin, xout );
  }
}
예제 #5
0
void PlanarPortal::teleportPointInsidePortal( const Vector3s& xin, Vector3s& xout ) const
{
    // Point must be in one and only one side of the portal
    assert( ( planeA().distanceToPoint( xin ) < 0 ) != ( planeB().distanceToPoint( xin ) < 0 ) );

    // Teleporting form A to B
    if( planeA().distanceToPoint( xin ) < 0 )
    {
        teleportPointThroughPlaneA( xin, xout );
    }
    // Teleporting form B to A
    else
    {
        teleportPointThroughPlaneB( xin, xout );
    }
}