Subversion Repositories AndroidProjects

Rev

Rev 1115 | Rev 1123 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

package com.gebauz.bauzoid.math.collision;

import com.gebauz.bauzoid.graphics.Graphics;
import com.gebauz.bauzoid.graphics.sprite.SpriteTransform;
import com.gebauz.bauzoid.math.Line2;
import com.gebauz.bauzoid.math.Vector2;
import com.gebauz.bauzoid.math.collision.Shape;

/** Interface for shape element. */
public abstract class BaseShapeElement
{
        // Constants========================================================================================

        // Embedded Types===================================================================================

        // Fields===========================================================================================
       
        private Shape mOwner = null;
       

        // Methods==========================================================================================

        public BaseShapeElement(Shape shape)
        {
                mOwner = shape;
        }
       
        //public abstract boolean isInside(float x, float y);
       
        /** Returns true if the shape intersects with this shape element.
         *  @param shape The shape tested against.
         *  @param transform Transformation matrix that brings this shape element's points into shape's space.
         */

        //public abstract boolean intersects(Shape shape, Matrix4 transform);
       
        /** Returns true if the shape intersects with this shape element. Returns a displacement vector
         *  that specifies by how much this shape element needs to be displaced in order to become non-colliding.
         *  @param shape The shape tested against.  
         *  @param transform Transformation matrix that brings this shape element's points into shape's space.
         */

        /*public abstract boolean intersects(Shape shape, Matrix4 transform, Vector2 displaceResult);
       
        public abstract boolean intersectsLine(Line2 line);*/


        /** Render debug output. */
        public abstract void renderDebug(Graphics graphics, SpriteTransform t);
       
        /** Get a list of untransformed points that make up the polygon. */
        public abstract Vector2[] getUntransformedPoints();
       
        /** Get a list of transformed (with the parent shape's SpriteTransform) points that make up the polygon. */
        public abstract Vector2[] getPoints();
       
        /** Get a list of untransformed line segments that make up the polygon. */
        public abstract Line2[] getUntransformedLineSegments();
       
        /** Get a list of transformed (with the parent shape's SpriteTransform) line segments that make up the polygon. */
        public abstract Line2[] getLineSegments();

        // Getters/Setters==================================================================================
       
        public final void setOwner(Shape shape)
        {
                mOwner = shape;
        }
       
        public final Shape getOwner()
        {
                return mOwner;
        }
       
        public final SpriteTransform getTransform()
        {
                return mOwner.transform;
        }
       

}