maspack.contact
Class Contact

java.lang.Object
  extended bymaspack.contact.Contact
All Implemented Interfaces:
java.io.Serializable

public class Contact
extends java.lang.Object
implements java.io.Serializable

Provides information about an individual point of contact between two rigid bodies.

See Also:
Serialized Form

Field Summary
 int bodyIndex1
          Index identifier for first rigid body.
 int bodyIndex2
          Index identifier for second rigid body.
 double dist
          Contact distance.
 double mu
          Friction coefficient.
 Vector3d nrml
          Contact normal, in the coordinate frame of the first rigid body.
 Point3d pnt1
          Contact point, in the coordinate frame of the first rigid body.
 double restitution
          Restitution coeffcient.
 
Constructor Summary
Contact()
          Creates a new contact object.
Contact(Contact c)
          Creates a new contact object that is a copy of an existing one.
Contact(int body1, int body2, Point3d pnt1, Vector3d nrml, double mu, double res)
          Creates a new contact object with specific values.
 
Method Summary
 void set(Contact c)
          Sets this contact to be a copy of an existing contact.
 void set(int body1, int body2, Point3d pnt1, Vector3d nrml, double mu, double res)
          Sets this contact to have specific values.
 java.lang.String toString()
          Returns a String representation of this contact, using the default format "%g" (see toString(String)).
 java.lang.String toString(NumberFormat fmt)
          Returns a String representation of this contact, in which each floating point element is formated using a C printf style as decribed by the parameter NumberFormat.
 java.lang.String toString(java.lang.String fmtStr)
          Returns a String representation of this contact, in which each floating point element is formated using a C printf style format string.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

bodyIndex1

public int bodyIndex1
Index identifier for first rigid body.


bodyIndex2

public int bodyIndex2
Index identifier for second rigid body.


pnt1

public Point3d pnt1
Contact point, in the coordinate frame of the first rigid body.


nrml

public Vector3d nrml
Contact normal, in the coordinate frame of the first rigid body. This quantity should have unit length.


dist

public double dist
Contact distance.


mu

public double mu
Friction coefficient.


restitution

public double restitution
Restitution coeffcient.

Constructor Detail

Contact

public Contact()
Creates a new contact object.


Contact

public Contact(int body1,
               int body2,
               Point3d pnt1,
               Vector3d nrml,
               double mu,
               double res)
Creates a new contact object with specific values.

Parameters:
body1 - index number for first contacting body
body2 - index number for second contacting body
pnt1 - contact point, in the coordinate frame of first body
nrml - contact normal, in the coordinate frame of first body (this quantity will be normalized).
mu - friction coefficient
res - restitution coefficient

Contact

public Contact(Contact c)
Creates a new contact object that is a copy of an existing one.

Parameters:
c - contact to be copied
Method Detail

set

public void set(int body1,
                int body2,
                Point3d pnt1,
                Vector3d nrml,
                double mu,
                double res)
Sets this contact to have specific values.

Parameters:
body1 - index number for first contacting body
body2 - index number for second contacting body
pnt1 - contact point, in the coordinate frame of first body
nrml - contact normal, in the coordinate frame of first body (this quantity will be normalized).
mu - friction coefficient
res - restitution coefficient

set

public void set(Contact c)
Sets this contact to be a copy of an existing contact.

Parameters:
c - contact to be copied

toString

public java.lang.String toString()
Returns a String representation of this contact, using the default format "%g" (see toString(String)).

Returns:
String representation of this contact

toString

public java.lang.String toString(java.lang.String fmtStr)
Returns a String representation of this contact, in which each floating point element is formated using a C printf style format string. For a description of the format string syntax, see NumberFormat.

Parameters:
fmtStr - numeric format specification
Returns:
String representation of this contact

toString

public java.lang.String toString(NumberFormat fmt)
Returns a String representation of this contact, in which each floating point element is formated using a C printf style as decribed by the parameter NumberFormat. When called numerous times, this routine can be more efficient than toString(String), because the NumberFormat does not need to be recreated each time from a specification string.

Parameters:
fmt - numeric format
Returns:
String representation of this contact