本文整理汇总了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;
}
示例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;
}
示例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();
}
示例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);
}
示例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:
{
//.........这里部分代码省略.........
示例6: IntArith
private IntArith(Network net, int a, Variable[] v, ConstraintTypes cType = ConstraintTypes.Hard)
: this(net, a, v, cType, 0)
{
}
示例7: IntComparison
private IntComparison(Network net, int comp, Variable[] v, ConstraintTypes cType)
: this(net, comp, v, cType, 0)
{
}
示例8: Ge
public virtual void Ge(ConstraintTypes cType, int weight)
{
Ge(0, cType, weight);
}
示例9: Equals
public void Equals(IntVariable v, ConstraintTypes cType)
{
Equals(v, cType, 0);
}
示例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);
}
示例11: Lt
public virtual void Lt(IntVariable v, ConstraintTypes cType)
{
Lt(v, cType, 0);
}