当前位置: 首页>>代码示例>>C#>>正文


C# LinearMath.IndexedVector3类代码示例

本文整理汇总了C#中BulletXNA.LinearMath.IndexedVector3的典型用法代码示例。如果您正苦于以下问题:C# IndexedVector3类的具体用法?C# IndexedVector3怎么用?C# IndexedVector3使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IndexedVector3类属于BulletXNA.LinearMath命名空间,在下文中一共展示了IndexedVector3类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DrawArc

 public void DrawArc(ref IndexedVector3 center, ref IndexedVector3 normal, ref IndexedVector3 axis, float radiusA, float radiusB, float minAngle, float maxAngle, ref IndexedVector3 color, bool drawSect, float stepDegrees)
 {
     IndexedVector3 vx = axis;
     IndexedVector3 vy = IndexedVector3.Cross(normal, axis);
     float step = stepDegrees * MathUtil.SIMD_RADS_PER_DEG;
     int nSteps = (int)((maxAngle - minAngle) / step);
     if (nSteps == 0)
     {
         nSteps = 1;
     }
     IndexedVector3 prev = center + radiusA * vx * (float)Math.Cos(minAngle) + radiusB * vy * (float)Math.Sin(minAngle);
     if (drawSect)
     {
         DrawLine(ref center, ref prev, ref color);
     }
     for (int i = 1; i <= nSteps; i++)
     {
         float angle = minAngle + (maxAngle - minAngle) * i / nSteps;
         IndexedVector3 next = center + radiusA * vx * (float)Math.Cos(angle) + radiusB * vy * (float)Math.Sin(angle);
         DrawLine(ref prev, ref next, ref color);
         prev = next;
     }
     if (drawSect)
     {
         DrawLine(ref center, ref prev, ref color);
     }
 }
开发者ID:JohnLouderback,项目名称:illuminati-engine-xna,代码行数:27,代码来源:BulletXNADeferredDebugDraw.cs

示例2: LocalGetSupportingVertexWithoutMargin

        public override IndexedVector3 LocalGetSupportingVertexWithoutMargin(ref IndexedVector3 vec)
        {
	        IndexedVector3 supVec = IndexedVector3.Zero;
	        float newDot,maxDot = float.MinValue;
#if DEBUG
			if (BulletGlobals.g_streamWriter != null && BulletGlobals.debugConvexHull)
			{
				BulletGlobals.g_streamWriter.WriteLine("localGetSupportingVertexWithoutMargin");
				MathUtil.PrintVector3(BulletGlobals.g_streamWriter, "vec", vec);
				for (int i = 0; i < m_unscaledPoints.Count; ++i)
				{
					MathUtil.PrintVector3(BulletGlobals.g_streamWriter, m_unscaledPoints[i]);
				}
			}
#endif

	        for (int i=0;i<m_unscaledPoints.Count;i++)
	        {
		        IndexedVector3 vtx = m_unscaledPoints[i] * m_localScaling;

		        newDot = IndexedVector3.Dot(vec,vtx);
		        if (newDot > maxDot)
		        {
			        maxDot = newDot;
			        supVec = vtx;
		        }
	        }
	        return supVec;
        }
开发者ID:bsamuels453,项目名称:BulletXNA,代码行数:29,代码来源:ConvexHullShape.cs

示例3: ProcessAllTriangles

        public override void ProcessAllTriangles(ITriangleCallback callback, ref IndexedVector3 aabbMin, ref IndexedVector3 aabbMax)
        {
	        IndexedVector3 halfExtents = (aabbMax - aabbMin) * .5f;
	        float radius = halfExtents.Length();
	        IndexedVector3 center = (aabbMax + aabbMin) * 0.5f;
        	
	        //this is where the triangles are generated, given AABB and plane equation (normal/constant)

	        IndexedVector3 tangentDir0;
            IndexedVector3 tangentDir1;

	        //tangentDir0/tangentDir1 can be precalculated
	        TransformUtil.PlaneSpace1(ref m_planeNormal, out tangentDir0, out tangentDir1);

            IndexedVector3 supVertex0 = IndexedVector3.Zero;
            IndexedVector3 supVertex1 = IndexedVector3.Zero;

	        IndexedVector3 projectedCenter = center - (IndexedVector3.Dot(m_planeNormal,center) - m_planeConstant)*m_planeNormal;

            IndexedVector3[] triangle = new IndexedVector3[3];
	        triangle[0] = (projectedCenter + tangentDir0*radius + tangentDir1*radius);
            triangle[1] = (projectedCenter + tangentDir0 * radius - tangentDir1 * radius);
            triangle[2] = (projectedCenter - tangentDir0 * radius - tangentDir1 * radius);

	        callback.ProcessTriangle(triangle,0,0);

	        triangle[0] = projectedCenter - tangentDir0*radius - tangentDir1*radius;
	        triangle[1] = projectedCenter - tangentDir0*radius + tangentDir1*radius;
	        triangle[2] = projectedCenter + tangentDir0*radius + tangentDir1*radius;

	        callback.ProcessTriangle(triangle,0,1);

        }
开发者ID:JohnLouderback,项目名称:illuminati-engine-xna,代码行数:33,代码来源:StaticPlaneShape.cs

示例4: Initialize

 public void Initialize(ref IndexedVector3 p0,ref IndexedVector3 p1,ref IndexedVector3 p2)
 {
     m_shapeType = BroadphaseNativeTypes.TRIANGLE_SHAPE_PROXYTYPE;
     m_vertices1[0] = p0;
     m_vertices1[1] = p1;
     m_vertices1[2] = p2;
 }
开发者ID:bsamuels453,项目名称:BulletXNA,代码行数:7,代码来源:TriangleShape.cs

示例5: GimGetPointInertia

 public static IndexedVector3 GimGetPointInertia(ref IndexedVector3 point, float mass)
 {
     float x2 = point.X * point.X;
     float y2 = point.Y * point.Y;
     float z2 = point.Z * point.Z;
     return new IndexedVector3(mass * (y2 + z2), mass * (x2 + z2), mass * (x2 + y2));
 }
开发者ID:Belxjander,项目名称:Asuna,代码行数:7,代码来源:GImpactMassUtil.cs

示例6: TriangleRaycastCallback

 public TriangleRaycastCallback() { } // for pool
 public TriangleRaycastCallback(ref IndexedVector3 from, ref IndexedVector3 to, EFlags flags)
 {
     m_from = from;
     m_to = to;
     m_flags = flags;
     m_hitFraction = 1f;
 }
开发者ID:ousttrue,项目名称:bullet-xna,代码行数:8,代码来源:RaycastCallback.cs

示例7: Initialise

        public void Initialise(ref IndexedVector3 pointA, ref IndexedVector3 pointB, ref IndexedVector3 normal, float distance)
        {
            /* Don't initialize default values twice in C# */
            m_lateralFrictionDir1 = IndexedVector3.Zero;
            m_lateralFrictionDir2 = IndexedVector3.Zero;
            m_lifeTime = 0;
            m_appliedImpulseLateral1 = 0f;
            m_appliedImpulseLateral2 = 0f;
            m_contactMotion1 = 0f;
            m_contactMotion2 = 0f;
            m_contactCFM1 = 0f;
            m_contactCFM2 = 0f;

            m_lateralFrictionInitialized = false;
            m_userPersistentData = null;
            m_appliedImpulse = 0f;
            m_partId0 = 0;
            m_partId1 = 0;
            m_index0 = 0;
            m_index1 = 0;
            m_combinedRestitution = 0f;
            m_combinedFriction = 0f;
            m_positionWorldOnA = IndexedVector3.Zero;
            m_positionWorldOnB = IndexedVector3.Zero;

            m_localPointA = pointA;
            m_localPointB = pointB;
            m_normalWorldOnB = normal;
            m_distance1 = distance;

            m_constraintRow[0].Reset();
            m_constraintRow[1].Reset();
            m_constraintRow[2].Reset();
        }
开发者ID:JohnLouderback,项目名称:illuminati-engine-xna,代码行数:34,代码来源:ManifoldPoint.cs

示例8: Reset

        public void Reset()
        {
            m_relpos1CrossNormal = IndexedVector3.Zero;
            m_contactNormal = IndexedVector3.Zero;
            m_relpos2CrossNormal = IndexedVector3.Zero;
            m_angularComponentA = IndexedVector3.Zero;
            m_angularComponentB = IndexedVector3.Zero;
            m_appliedPushImpulse = 0f;
            m_appliedImpulse = 0f;
            m_friction = 0f;
            m_jacDiagABInv = 0f;
            m_numConsecutiveRowsPerKernel = 0;
            m_frictionIndex = 0;
            m_solverBodyA = null;
            m_companionIdA = 0;
            m_solverBodyB = null;
            m_companionIdB = 0;
            m_originalContactPoint = null;
            //m_originalContactPointConstraint = null;
            m_rhs = 0f;
            m_cfm = 0;
            m_lowerLimit = 0f;
            m_upperLimit = 0f;
            m_rhsPenetration = 0f;
            m_overrideNumSolverIterations = -1;

        }
开发者ID:Belxjander,项目名称:Asuna,代码行数:27,代码来源:SolverConstraint.cs

示例9: LocalGetSupportingVertexWithoutMargin

        public override IndexedVector3 LocalGetSupportingVertexWithoutMargin(ref IndexedVector3 vec0)
        {
	        IndexedVector3 supVec = IndexedVector3.Zero;

	        IndexedVector3 vec = vec0;
	        float lenSqr = vec.LengthSquared();
	        if (lenSqr < 0.0001f)
	        {
                vec = new IndexedVector3(1, 0, 0);
	        } 
            else
	        {
                float rlen = (1.0f) / (float)Math.Sqrt(lenSqr);
                vec *= rlen;
                //vec.Normalize();
            }

	        LocalSupportVertexCallback supportCallback = new LocalSupportVertexCallback(ref vec);
	        IndexedVector3 aabbMax = new IndexedVector3(float.MaxValue);
            IndexedVector3 aabbMin = -aabbMax;
	        m_stridingMesh.InternalProcessAllTriangles(supportCallback,ref aabbMin,ref aabbMax);
	        supVec = supportCallback.GetSupportVertexLocal();

	        return supVec;

        }
开发者ID:JohnLouderback,项目名称:illuminati-engine-xna,代码行数:26,代码来源:ConvexTriangleMeshShape.cs

示例10: Distance

 public static bool	Distance(ConvexShape shape0,ref IndexedMatrix wtrs0,ConvexShape shape1,ref IndexedMatrix wtrs1,ref IndexedVector3 guess,ref GjkEpaSolver2Results results)
 {
     using (GjkEpaSolver2MinkowskiDiff shape = BulletGlobals.GjkEpaSolver2MinkowskiDiffPool.Get())
     using (GJK gjk = BulletGlobals.GJKPool.Get())
     {
         Initialize(shape0, ref wtrs0, shape1, ref wtrs1, ref results, shape, false);
         gjk.Initialise();
         GJKStatus gjk_status = gjk.Evaluate(shape, ref guess);
         if (gjk_status == GJKStatus.Valid)
         {
             IndexedVector3 w0 = IndexedVector3.Zero;
             IndexedVector3 w1 = IndexedVector3.Zero;
             for (uint i = 0; i < gjk.m_simplex.rank; ++i)
             {
                 float p = gjk.m_simplex.p[i];
                 w0 += shape.Support(ref gjk.m_simplex.c[i].d, 0) * p;
                 IndexedVector3 temp = -gjk.m_simplex.c[i].d;
                 w1 += shape.Support(ref temp, 1) * p;
             }
             results.witnesses0 = wtrs0 * w0;
             results.witnesses1 = wtrs0 * w1;
             results.normal = w0 - w1;
             results.distance = results.normal.Length();
             results.normal /= results.distance > GJK_MIN_DISTANCE ? results.distance : 1;
             return (true);
         }
         else
         {
             //GjkEpaSolver2Status
             results.status = (gjk_status == GJKStatus.Inside) ? GjkEpaSolver2Status.Penetrating : GjkEpaSolver2Status.GJK_Failed;
             return (false);
         }
     }
 }
开发者ID:ousttrue,项目名称:bullet-xna,代码行数:34,代码来源:GjkEpaSolver2.cs

示例11: SetupWorldObjects

        //----------------------------------------------------------------------------------------------

        public void SetupWorldObjects()
        {
            IndexedVector3 halfExtents = new IndexedVector3(10, 5, 10);
            CollisionShape groundShape = new BoxShape(ref halfExtents);

            IndexedVector3 world1Center = new IndexedVector3(-20, -5, 0);
            IndexedVector3 world2Center = new IndexedVector3(20, -5, 0);

            IndexedMatrix groundTransform1 = IndexedMatrix.CreateTranslation(world1Center);
            IndexedMatrix groundTransform2 = IndexedMatrix.CreateTranslation(world2Center);

            IndexedVector3 halfExtents2 = new IndexedVector3(0.5f);
            CollisionShape smallBoxShape = new BoxShape(ref halfExtents2);

            //IndexedMatrix groundTransform = IndexedMatrix.CreateTranslation(new IndexedVector3(0,-10,0));
            float mass = 0f;

            LocalCreateRigidBodyMultiWorld(mass, ref groundTransform1, groundShape ,m_worlds[0]);
            LocalCreateRigidBodyMultiWorld(mass, ref groundTransform2, groundShape, m_worlds[1]);

            mass = 1f;
            for (int i = 0; i < 5; ++i)
            {
                IndexedVector3 offset = new IndexedVector3(0, halfExtents.Y + halfExtents2.Y + (2 * i), 0);

                IndexedMatrix boxTransform1 = IndexedMatrix.CreateTranslation(world1Center+offset);
                IndexedMatrix boxTransform2 = IndexedMatrix.CreateTranslation(world2Center + offset);

                LocalCreateRigidBodyMultiWorld(mass, ref boxTransform1, smallBoxShape, m_worlds[0]);
                LocalCreateRigidBodyMultiWorld(mass, ref boxTransform2, smallBoxShape, m_worlds[1]);
            }

        }
开发者ID:ousttrue,项目名称:bullet-xna,代码行数:35,代码来源:MultiWorldDemo.cs

示例12: DebugDraw

	    ///btActionInterface interface
        public virtual void DebugDraw(IDebugDraw debugDrawer)
        {
	        for (int v=0;v<GetNumWheels();v++)
	        {
		        IndexedVector3 wheelColor = new IndexedVector3(0,1,1);
		        if (GetWheelInfo(v).m_raycastInfo.m_isInContact)
		        {
			        wheelColor = new IndexedVector3(0,0,1);
		        } else
		        {
			        wheelColor= new IndexedVector3(1,0,1);
		        }

		        IndexedVector3 wheelPosWS = GetWheelInfo(v).m_worldTransform._origin;

                IndexedMatrix temp = GetWheelInfo(v).m_worldTransform;
                IndexedVector3 axle = new IndexedVector3(
        GetWheelInfo(v).m_worldTransform._basis._el0[GetRightAxis()],
        GetWheelInfo(v).m_worldTransform._basis._el1[GetRightAxis()],
        GetWheelInfo(v).m_worldTransform._basis._el2[GetRightAxis()]);

		        //debug wheels (cylinders)
		        debugDrawer.DrawLine(wheelPosWS,wheelPosWS+axle,wheelColor);
		        debugDrawer.DrawLine(wheelPosWS,GetWheelInfo(v).m_raycastInfo.m_contactPointWS,wheelColor);

	        }
        }
开发者ID:JohnLouderback,项目名称:illuminati-engine-xna,代码行数:28,代码来源:RaycastVehicle.cs

示例13: IndexedVector4

 public IndexedVector4(IndexedVector3 v,float w)
 {
     X = v.X;
     Y = v.Y;
     Z = v.Z;
     W = w;
 }
开发者ID:Belxjander,项目名称:Asuna,代码行数:7,代码来源:IndexedVector4.cs

示例14: BatchedUnitVectorGetSupportingVertexWithoutMargin

        //notice that the vectors should be unit length
		public override void BatchedUnitVectorGetSupportingVertexWithoutMargin(IndexedVector3[] vectors, IndexedVector4[] supportVerticesOut, int numVectors) 
        {
	        for (int i=0;i<numVectors;i++)
	        {
		        supportVerticesOut[i] = IndexedVector4.Zero;
	        }
        }
开发者ID:Belxjander,项目名称:Asuna,代码行数:8,代码来源:SphereShape.cs

示例15: LocalGetSupportingVertex

        public virtual IndexedVector3 LocalGetSupportingVertex(ref IndexedVector3 vec)
        {
	        IndexedVector3 supportVertex;

            IndexedMatrix ident = IndexedMatrix.Identity;

	        SupportVertexCallback supportCallback = new SupportVertexCallback(ref vec,ref ident);

	        IndexedVector3 aabbMax = MathUtil.MAX_VECTOR;
            IndexedVector3 aabbMin = MathUtil.MIN_VECTOR;

            // URGGHHH!
            if (m_inConstructor)
            {
                this.ProcessAllTrianglesCtor(supportCallback, ref aabbMin, ref aabbMax);
            }
            else
            {
                ProcessAllTriangles(supportCallback, ref aabbMin, ref aabbMax);
            }
            
	        supportVertex = supportCallback.GetSupportVertexLocal();
            supportCallback.Cleanup();
	        return supportVertex;

        }
开发者ID:bsamuels453,项目名称:BulletXNA,代码行数:26,代码来源:TriangleMeshShape.cs


注:本文中的BulletXNA.LinearMath.IndexedVector3类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。