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


C# ConstraintTypes类代码示例

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


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

示例1: Constraint

 /// <summary> Constructor.
 /// (for invocation by subclass constructors, typically implicit)
 /// </summary>
 protected internal Constraint(Network net, ConstraintTypes cType)
 {
     Network = net;
     Index = -1;
     Network.ADD(this);
     CType = cType;
 }
开发者ID:samplet,项目名称:HalfAndHalf,代码行数:10,代码来源:Constraint.cs

示例2: Relation

 public Relation(Network net, Variable v0, bool[][] rel, Variable v1, ConstraintTypes cType, int weight)
     : base(net, cType, weight)
 {
     _rel = rel;
     _v0 = v0;
     _v1 = v1;
 }
开发者ID:kikoanis,项目名称:CSharpCream,代码行数:7,代码来源:Relation.cs

示例3: Element

 public Element(Network net, Variable v0, Variable v1, Variable[] v, ConstraintTypes cType, int weight)
     : base(net, cType, weight)
 {
     _v0 = v0;
     _v1 = v1;
     _v = (Variable[])v.Clone();
 }
开发者ID:samplet,项目名称:HalfAndHalf,代码行数:7,代码来源:Element.cs

示例4: Sequential

 public Sequential(Network net, Variable[] v, int[] l, ConstraintTypes cType, int weight)
     : base(net, cType, weight)
 {
     _v = new Variable[v.Length];
     v.CopyTo(_v, 0);
     _l = new int[l.Length];
     l.CopyTo(_l, 0);
 }
开发者ID:samplet,项目名称:HalfAndHalf,代码行数:8,代码来源:Sequential.cs

示例5: CreateConstraint

        /// <summary>
        /// Creates the constraint.
        /// </summary>
        /// <param name="type">The type.</param>
        /// <param name="rigidBodyA">The rigid body a.</param>
        /// <param name="frameA">The frame a.</param>
        /// <param name="useReferenceFrameA">if set to <c>true</c> [use reference frame a].</param>
        /// <returns></returns>
        /// <exception cref="System.Exception">
        /// Cannot perform this action when the physics engine is set to CollisionsOnly
        /// or
        /// Both RigidBodies must be valid
        /// or
        /// A Gear constraint always needs two rigidbodies to be created.
        /// </exception>
        public static Constraint CreateConstraint(ConstraintTypes type, RigidbodyComponent rigidBodyA, Matrix frameA, bool useReferenceFrameA = false)
        {
            if (rigidBodyA == null) throw new Exception("Both RigidBodies must be valid");

            var rbA = rigidBodyA.InternalRigidBody;

            switch (type)
            {
                case ConstraintTypes.Point2Point:
                    {
                        var constraint = new Point2PointConstraint
                        {
                            InternalPoint2PointConstraint = new BulletSharp.Point2PointConstraint(rbA, frameA.TranslationVector),

                            RigidBodyA = rigidBodyA,
                        };

                        constraint.InternalConstraint = constraint.InternalPoint2PointConstraint;

                        rigidBodyA.LinkedConstraints.Add(constraint);

                        return constraint;
                    }
                case ConstraintTypes.Hinge:
                    {
                        var constraint = new HingeConstraint
                        {
                            InternalHingeConstraint = new BulletSharp.HingeConstraint(rbA, frameA, useReferenceFrameA),

                            RigidBodyA = rigidBodyA,
                        };

                        constraint.InternalConstraint = constraint.InternalHingeConstraint;

                        rigidBodyA.LinkedConstraints.Add(constraint);

                        return constraint;
                    }
                case ConstraintTypes.Slider:
                    {
                        var constraint = new SliderConstraint
                        {
                            InternalSliderConstraint = new BulletSharp.SliderConstraint(rbA, frameA, useReferenceFrameA),

                            RigidBodyA = rigidBodyA,
                        };

                        constraint.InternalConstraint = constraint.InternalSliderConstraint;

                        rigidBodyA.LinkedConstraints.Add(constraint);

                        return constraint;
                    }
                case ConstraintTypes.ConeTwist:
                    {
                        var constraint = new ConeTwistConstraint
                        {
                            InternalConeTwistConstraint = new BulletSharp.ConeTwistConstraint(rbA, frameA),

                            RigidBodyA = rigidBodyA
                        };

                        constraint.InternalConstraint = constraint.InternalConeTwistConstraint;

                        rigidBodyA.LinkedConstraints.Add(constraint);

                        return constraint;
                    }
                case ConstraintTypes.Generic6DoF:
                    {
                        var constraint = new Generic6DoFConstraint
                        {
                            InternalGeneric6DofConstraint = new BulletSharp.Generic6DofConstraint(rbA, frameA, useReferenceFrameA),

                            RigidBodyA = rigidBodyA
                        };

                        constraint.InternalConstraint = constraint.InternalGeneric6DofConstraint;

                        rigidBodyA.LinkedConstraints.Add(constraint);

                        return constraint;
                    }
                case ConstraintTypes.Generic6DoFSpring:
                    {
//.........这里部分代码省略.........
开发者ID:psowinski,项目名称:xenko,代码行数:101,代码来源:Simulation.cs

示例6: IntArith

 private IntArith(Network net, int a, Variable[] v, ConstraintTypes cType = ConstraintTypes.Hard)
     : this(net, a, v, cType, 0)
 {
 }
开发者ID:kikoanis,项目名称:CSharpCream,代码行数:4,代码来源:IntArith.cs

示例7: IntComparison

 private IntComparison(Network net, int comp, Variable[] v, ConstraintTypes cType)
     : this(net, comp, v, cType, 0)
 {
 }
开发者ID:samplet,项目名称:HalfAndHalf,代码行数:4,代码来源:IntComparison.cs

示例8: Ge

 public virtual void Ge(ConstraintTypes cType, int weight)
 {
     Ge(0, cType, weight);
 }
开发者ID:samplet,项目名称:HalfAndHalf,代码行数:4,代码来源:IntVariable.cs

示例9: Equals

 public void Equals(IntVariable v, ConstraintTypes cType)
 {
     Equals(v, cType, 0);
 }
开发者ID:samplet,项目名称:HalfAndHalf,代码行数:4,代码来源:IntVariable.cs

示例10: NotEquals

 public virtual void NotEquals(int value, ConstraintTypes cType, int weight)
 {
     Network net = Network;
     new NotEquals(net, this, new IntVariable(net, value), cType, weight);
 }
开发者ID:samplet,项目名称:HalfAndHalf,代码行数:5,代码来源:IntVariable.cs

示例11: Lt

 public virtual void Lt(IntVariable v, ConstraintTypes cType)
 {
     Lt(v, cType, 0);
 }
开发者ID:samplet,项目名称:HalfAndHalf,代码行数:4,代码来源:IntVariable.cs


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