• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# LinearMath.IndexedVector3类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: GetHalfExtentsWithMargin

	    public virtual IndexedVector3 GetHalfExtentsWithMargin()
	    {
		    IndexedVector3 halfExtents = GetHalfExtentsWithoutMargin();
		    IndexedVector3 margin = new IndexedVector3(GetMargin());
		    halfExtents += margin;
		    return halfExtents;
	    }
开发者ID:Belxjander,项目名称:Asuna,代码行数:7,代码来源:CylinderShape.cs


示例17: DebugDrawLine

 public static void DebugDrawLine(ref IndexedVector3 from, ref IndexedVector3 to, ref IndexedVector3 color)
 {
     if (BulletGlobals.gDebugDraw != null)
     {
         BulletGlobals.gDebugDraw.DrawLine(ref from, ref to, ref color);
     }
 }
开发者ID:JohnLouderback,项目名称:illuminati-engine-xna,代码行数:7,代码来源:InternalEdgeUtility.cs


示例18: SetAngularLimits

		protected virtual int SetAngularLimits(ConstraintInfo2 info, int row_offset, ref IndexedMatrix transA, ref IndexedMatrix transB, ref IndexedVector3 linVelA, ref IndexedVector3 linVelB, ref IndexedVector3 angVelA, ref IndexedVector3 angVelB)
		{
			Generic6DofConstraint d6constraint = this;
			int row = row_offset;
			//solve angular limits
			for (int i = 0; i < 3; i++)
			{
				if (d6constraint.GetRotationalLimitMotor(i).NeedApplyTorques())
				{
					IndexedVector3 axis = d6constraint.GetAxis(i);
					int tempFlags = ((int)m_flags) >> ((i + 3) * BT_6DOF_FLAGS_AXIS_SHIFT);
					SixDofFlags flags = (SixDofFlags)tempFlags;
					if (0 == (flags & SixDofFlags.BT_6DOF_FLAGS_CFM_NORM))
					{
						m_angularLimits[i].m_normalCFM = info.m_solverConstraints[0].m_cfm;
					}
					if (0 == (flags & SixDofFlags.BT_6DOF_FLAGS_CFM_STOP))
					{
						m_angularLimits[i].m_stopCFM = info.m_solverConstraints[0].m_cfm;
					}
					if (0 == (flags & SixDofFlags.BT_6DOF_FLAGS_ERP_STOP))
					{
						m_angularLimits[i].m_stopERP = info.erp;
					}
					row += GetLimitMotorInfo2(d6constraint.GetRotationalLimitMotor(i),
														ref transA, ref transB, ref linVelA, ref linVelB, ref angVelA, ref angVelB, info, row, ref axis, 1, false);
				}
			}

			return row;
		}
开发者ID:Belxjander,项目名称:Asuna,代码行数:31,代码来源:Generic6DofConstraint.cs


示例19: CalculateLocalInertia

        public override void CalculateLocalInertia(float mass, out IndexedVector3 inertia)
        {
	        ///this linear upscaling is not realistic, but we don't deal with large mass ratios...
	        IndexedVector3 tmpInertia;
	        m_childConvexShape.CalculateLocalInertia(mass, out tmpInertia);
	        inertia = tmpInertia * m_uniformScalingFactor;
        }
开发者ID:JohnLouderback,项目名称:illuminati-engine-xna,代码行数:7,代码来源:UniformScalingShape.cs


示例20: BU_Simplex1to4

	    public BU_Simplex1to4(ref IndexedVector3 pt0,ref IndexedVector3 pt1,ref IndexedVector3 pt2)
        {
            m_shapeType = BroadphaseNativeTypes.TETRAHEDRAL_SHAPE_PROXYTYPE;
            AddVertex(ref pt0);
            AddVertex(ref pt1);
            AddVertex(ref pt2);
        }
开发者ID:Belxjander,项目名称:Asuna,代码行数:7,代码来源:TetrahedronShape.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Core.Client类代码示例发布时间:2022-05-24
下一篇:
C# LinearMath.IndexedQuaternion类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap