예제 #1
0
        public override void addPivot(Pivot pivot)
        {
            if (!onBeam(pivot.point))
                throw new Exception("Attempted to add a point not on the beam");

            base.addPivot(pivot);
        }
예제 #2
0
        public PivotController(RigidBodyController body, Pivot pivot)
        {
            this.body = body;
            this.pivot = pivot;

            body.addPivot(pivot);
        }
예제 #3
0
        public RigidBody(Matrix g)
        {
            forces = new ArrayList();
            pivots = new ArrayList();

            geometry = g;
            deformations = new Matrix(g.getHeight(),g.getWidth());
            transformations = new Matrix(g.getHeight(),g.getWidth());

            cmPoint = new Pivot(new Point(), Pivot.Type.CM);
            pivots.Add(cmPoint);
        }
예제 #4
0
        public Matrix transformations; //Matrix to define the transformaions of the body.

        #endregion Fields

        #region Constructors

        public RigidBody()
        {
            geometry = null;
            deformations = null;
            transformations = null;

            forces = new ArrayList();
            pivots = new ArrayList();

            cmPoint = new Pivot(new Point(), Pivot.Type.CM);
            pivots.Add(cmPoint);
        }
예제 #5
0
        public Beam(Point A, Point B)
        {
            Matrix max = new Matrix(2,2);
            if (A.x <= B.x){
                max[0][0] = A.x;
                max[0][1] = A.y;
                max[1][0] = B.x;
                max[1][1] = B.y;
            }else{
                max[0][0] = B.x;
                max[0][1] = B.y;
                max[1][0] = A.x;
                max[1][1] = A.y;
            }
            geometry = max;

            //the center of mass is half way bettween the two end points
            Pivot cm = new Pivot(new Point((A.x + B.y)/2.0,(A.x + B.y)/2.0), Pivot.Type.CM);
            setCenterOfMass(cm);
        }
예제 #6
0
 public void setCenterOfMass(Pivot pivot)
 {
     pivots.Remove(cmPoint);
     cmPoint = pivot;
     pivots.Add(cmPoint);
 }
예제 #7
0
 public virtual void addPivot(Pivot pivot)
 {
     pivots.Add(pivot);
 }