frams_client_3d
Class Creature

java.lang.Object
  extended byframs_client_3d.Creature

public class Creature
extends java.lang.Object

Framstick creature body class.

Author:
MoMaT

Field Summary
private  java.lang.String genotype
           
private  int group
           
private  int index
           
private  int[][] joints
           
private  int jointsCount
           
private  java.lang.String name
           
private  float[][] parts
           
private  int partsCount
           
 
Constructor Summary
Creature(java.lang.String name, java.lang.String genotype, int partsCount, int jointsCount, int group, int index)
          Class constructor.
 
Method Summary
 void addJoint(int p1, int p2)
          Add joint to the creature body.
 void addPart(float x, float y, float z)
          Add part to the creature body.
 java.lang.String getGenotype()
           
 int getGroup()
           
 int getIndex()
           
 int[][] getJoints()
           
 float[][] getParts()
           
 float jointLength(int index)
          Calculates the length of vector between two joint points.
 float[] jointRotation(int index)
          Calculates the angle and the rotation axis between a joint and the base vector.
 float[] jointTranslation(int index)
          Gets translation vector to the middle point of a joint.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

name

private java.lang.String name

genotype

private java.lang.String genotype

partsCount

private int partsCount

jointsCount

private int jointsCount

joints

private int[][] joints

parts

private float[][] parts

group

private int group

index

private int index
Constructor Detail

Creature

public Creature(java.lang.String name,
                java.lang.String genotype,
                int partsCount,
                int jointsCount,
                int group,
                int index)
Class constructor. Initializes data structure.

Parameters:
name -
partsCount - number of parts
jointsCount - number of joints
group - creature group
index - position in a group
Method Detail

addJoint

public void addJoint(int p1,
                     int p2)
Add joint to the creature body.

Parameters:
p1 -
p2 -

addPart

public void addPart(float x,
                    float y,
                    float z)
Add part to the creature body.

Parameters:
x -
y -
z -

toString

public java.lang.String toString()

getGenotype

public java.lang.String getGenotype()

getJoints

public int[][] getJoints()

getParts

public float[][] getParts()

getGroup

public int getGroup()

getIndex

public int getIndex()

jointTranslation

public float[] jointTranslation(int index)
Gets translation vector to the middle point of a joint.

Parameters:
index - index of joint in a joints array
Returns:
translation vector

jointLength

public float jointLength(int index)
Calculates the length of vector between two joint points.

Parameters:
index - index of joint in a joints array
Returns:
length of vector

jointRotation

public float[] jointRotation(int index)
Calculates the angle and the rotation axis between a joint and the base vector.

Parameters:
index - index of joint in a joints array
Returns:
the array of angle and axis x, y, z coordinates