Beispiel #1
0
 public Geometry(
     IShape shape,
     CommonGeometry baseGeometry,
     ObjectGeometryType geometryType)
     : this(shape, baseGeometry, geometryType, false)
 {
 }
        private IGeometry[] GetShapesGeometry(
            List <Vector3d[]> inputVertexPosition,
            List <int[][]> inputTriangle)
        {
            IGeometry[]     geometry    = new IGeometry[inputVertexPosition.Count];
            List <Vector3d> verticesSum = new List <Vector3d>();

            for (int i = 0; i < inputVertexPosition.Count; i++)
            {
                TriangleMesh[] triangleMeshes = CommonUtilities.GetTriangleMeshes(inputTriangle[i]);

                var idx = new int[inputVertexPosition[i].Length];

                for (int j = 0; j < inputVertexPosition[i].Length; j++)
                {
                    idx[j] = verticesSum.Count + j;
                }

                var baseGeometry = new CommonGeometry(inputVertexPosition[i], triangleMeshes, idx);

                geometry[i] = new Geometry(this, baseGeometry, ObjectGeometryType.ConvexShape, true);

                verticesSum.AddRange(inputVertexPosition[i].ToList());
            }

            //TODO
            //Vertices = verticesSum.ToArray();

            SetGeometry();

            return(geometry);
        }
Beispiel #3
0
 public Geometry(
     IShape shape,
     CommonGeometry baseGeometry,
     ObjectGeometryType geometryType,
     bool getAdjacencyList)
 {
     Shape        = shape;
     GeometryType = geometryType;
     BaseGeometry = baseGeometry;
 }
        public ConvexShape(
            CommonGeometry baseGeometry,
            Vector3d position,
            double mass,
            bool isStatic) : base()
        {
            ObjectType = ObjectType.RigidBody;

            ObjectGeometry = new Geometry(
                this,
                baseGeometry,
                ObjectGeometryType.ConvexShape,
                true);

            SetIsStatic(isStatic);
            SetMass(mass);
            SetPosition(position);
            ShapeInit();
        }
Beispiel #5
0
        public ConcaveShape(
            CommonGeometry baseGeometry,
            Vector3d position,
            double mass,
            bool isStatic) : base()
        {
            ObjectType = ObjectType.RigidBody;
            SetIsStatic(isStatic);

            Position = position;

            ObjectGeometry = new Geometry(
                this,
                baseGeometry,
                ObjectGeometryType.ConcaveShape,
                true);

            SetRotationMatrix();
            SetMass(mass);

            SetShapeGeometry();
            SetRelativePosition();
            SetAABB();
        }