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


C# ConstraintType类代码示例

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


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

示例1: CreateRagdollConstraint

        void CreateRagdollConstraint(string boneName, string parentName, ConstraintType type,
            Vector3 axis, Vector3 parentAxis, Vector2 highLimit, Vector2 lowLimit, bool disableCollision = true)
        {
            Node boneNode = Node.GetChild(boneName, true);
            Node parentNode = Node.GetChild(parentName, true);
            if (boneNode == null)
            {
                Log.Warn($"Could not find bone {boneName} for creating ragdoll constraint");
                return;
            }
            if (parentNode == null)
            {
                Log.Warn($"Could not find bone {parentName} for creating ragdoll constraint");
                return;
            }

            Constraint constraint = boneNode.CreateComponent<Constraint>();
            constraint.ConstraintType = type;
            // Most of the constraints in the ragdoll will work better when the connected bodies don't collide against each other
            constraint.DisableCollision = disableCollision;
            // The connected body must be specified before setting the world position
            constraint.OtherBody = parentNode.GetComponent<RigidBody>();
            // Position the constraint at the child bone we are connecting
            constraint.SetWorldPosition(boneNode.WorldPosition);
            // Configure axes and limits
            constraint.SetAxis(axis);
            constraint.SetOtherAxis(parentAxis);
            constraint.HighLimit = highLimit;
            constraint.LowLimit = lowLimit;
        }
开发者ID:Type1J,项目名称:AtomicExamples,代码行数:30,代码来源:Ragdoll.cs

示例2: Load

        public IList<DatabaseConstraint> Load(string tableName, string schemaName, ConstraintType constraintType)
        {
            if (string.IsNullOrEmpty(tableName)) throw new ArgumentNullException("tableName", "must have tableName");

            switch (constraintType)
            {
                case ConstraintType.PrimaryKey:
                    return PrimaryKeys(tableName, schemaName);

                case ConstraintType.ForeignKey:
                    return ForeignKeys(tableName, schemaName);

                case ConstraintType.UniqueKey:
                    return _ukConverter.Constraints(tableName, schemaName);

                case ConstraintType.Check:
                    return _ckConverter.Constraints(tableName, schemaName);

                case ConstraintType.Default:
                    return _dfConverter.Constraints(tableName, schemaName);

                default:
                    throw new ArgumentOutOfRangeException("constraintType");
            }
        }
开发者ID:faddiv,项目名称:dbschemareader,代码行数:25,代码来源:SchemaConstraintLoader.cs

示例3: Constraint

 /// <summary>
 /// Initializes a new instance of the <see cref="Constraint"/> class.
 /// </summary>
 /// <param name="condition">The condition.</param>
 /// <param name="constraintColumnName">Name of the constraint column.</param>
 public Constraint(ConstraintType condition, string constraintColumnName)
 {
     Condition = condition;
     ColumnName = constraintColumnName;
     QualifiedColumnName = constraintColumnName;
     ConstructionFragment = constraintColumnName;
 }
开发者ID:RyanDansie,项目名称:SubSonic-2.0,代码行数:12,代码来源:Constraint.cs

示例4: NonlinearConstraint

        /// <summary>
        ///   Constructs a new nonlinear constraint.
        /// </summary>
        /// 
        /// <param name="objective">The objective function to which this constraint refers.</param>
        /// <param name="function">A lambda expression defining the left hand side of the 
        ///   constraint equation.</param>
        /// <param name="shouldBe">How the left hand side of the constraint should be 
        ///   compared to the given <paramref name="value"/>.</param>
        /// <param name="value">The right hand side of the constraint equation.</param>
        /// 
        public NonlinearConstraint(IObjectiveFunction objective,
            Func<double[], double> function, ConstraintType shouldBe, double value)
        {
            int n = objective.NumberOfVariables;

            this.Create(objective.NumberOfVariables, function, shouldBe, value, null, 0.0);
        }
开发者ID:tapans,项目名称:Kinect-and-Machine-Learning,代码行数:18,代码来源:NonlinearConstraint.cs

示例5: ColumnConstraintInfo

        public ColumnConstraintInfo(ConstraintType constraintType)
        {
            if (constraintType == ConstraintType.Check)
                throw new ArgumentException("Check is not a column-level constraint");

            ConstraintType = constraintType;
        }
开发者ID:deveel,项目名称:deveeldb,代码行数:7,代码来源:ColumnConstraintInfo.cs

示例6: Constraint

 /// <summary>
 /// Constructor using only the Main Table.
 /// </summary>
 /// <param name="type"></param>
 /// <param name="table"></param>
 /// <param name="col"></param>
 public Constraint(ConstraintType type, Table table, int[] col)
 {
     _type = type;
     _mainTable = table;
     _mainColumns = col;
     _len = col.Length;
 }
开发者ID:furesoft,项目名称:SharpHSQL,代码行数:13,代码来源:Constraint.cs

示例7: QuadraticConstraint

        /// <summary>
        ///   Constructs a new quadratic constraint in the form <c>x'Ax + x'b</c>.
        /// </summary>
        /// 
        /// <param name="objective">The objective function to which this constraint refers.</param>
        /// <param name="quadraticTerms">The matrix of <c>A</c> quadratic terms.</param>
        /// <param name="linearTerms">The vector <c>b</c> of linear terms.</param>
        /// <param name="shouldBe">How the left hand side of the constraint should be compared to the given <paramref name="value"/>.</param>
        /// <param name="value">The right hand side of the constraint equation.</param>
        /// <param name="withinTolerance">The tolerance for violations of the constraint. Equality
        ///   constraints should set this to a small positive value. Default is 0.</param>
        ///
        public QuadraticConstraint(IObjectiveFunction objective,
            double[,] quadraticTerms, double[] linearTerms = null,
            ConstraintType shouldBe = ConstraintType.LesserThanOrEqualTo,
            double value = 0, double withinTolerance = 0.0)
        {
            int n = objective.NumberOfVariables;

            if (quadraticTerms == null)
                throw new ArgumentNullException("quadraticTerms");

            if (quadraticTerms.GetLength(0) != quadraticTerms.GetLength(1))
                throw new DimensionMismatchException("quadraticTerms", "Matrix must be square.");

            if (quadraticTerms.GetLength(0) != n)
                throw new DimensionMismatchException("quadraticTerms", 
                    "Matrix rows must match the number of variables in the objective function.");

            if (linearTerms != null)
            {
                if (linearTerms.Length != n)
                    throw new DimensionMismatchException("linearTerms",
                        "The length of the linear terms vector must match the "+
                        "number of variables in the objective function.");
            }
            else
            {
                linearTerms = new double[n];
            }

            this.QuadraticTerms = quadraticTerms;
            this.LinearTerms = linearTerms;

            Create(objective, function, shouldBe, value, gradient, withinTolerance);
        }
开发者ID:huanzl0503,项目名称:framework,代码行数:46,代码来源:QuadraticConstraint.cs

示例8: Constraint

 protected Constraint(ObjectName name, Table table, ConstraintType constraintType, IEnumerable<Column> keyColumns)
 {
     _name = name;
     _table = table;
     _constraintType = constraintType;
     _keyColumns = new List<Column>(keyColumns);
 }
开发者ID:gregorypilar,项目名称:interlace,代码行数:7,代码来源:Constraint.cs

示例9: ResetLink

 // Set all the parameters for this constraint to a fixed, non-movable constraint.
 public override void ResetLink()
 {
     // constraintType = ConstraintType.D6_CONSTRAINT_TYPE;
     constraintType = ConstraintType.BS_FIXED_CONSTRAINT_TYPE;
     linearLimitLow = OMV.Vector3.Zero;
     linearLimitHigh = OMV.Vector3.Zero;
     angularLimitLow = OMV.Vector3.Zero;
     angularLimitHigh = OMV.Vector3.Zero;
     useFrameOffset = BSParam.LinkConstraintUseFrameOffset;
     enableTransMotor = BSParam.LinkConstraintEnableTransMotor;
     transMotorMaxVel = BSParam.LinkConstraintTransMotorMaxVel;
     transMotorMaxForce = BSParam.LinkConstraintTransMotorMaxForce;
     cfm = BSParam.LinkConstraintCFM;
     erp = BSParam.LinkConstraintERP;
     solverIterations = BSParam.LinkConstraintSolverIterations;
     frameInAloc = OMV.Vector3.Zero;
     frameInArot = OMV.Quaternion.Identity;
     frameInBloc = OMV.Vector3.Zero;
     frameInBrot = OMV.Quaternion.Identity;
     useLinearReferenceFrameA = true;
     springAxisEnable = new bool[6];
     springDamping = new float[6];
     springStiffness = new float[6];
     for (int ii = 0; ii < springAxisEnable.Length; ii++)
     {
         springAxisEnable[ii] = false;
         springDamping[ii] = BSAPITemplate.SPRING_NOT_SPECIFIED;
         springStiffness[ii] = BSAPITemplate.SPRING_NOT_SPECIFIED;
     }
     springLinearEquilibriumPoint = OMV.Vector3.Zero;
     springAngularEquilibriumPoint = OMV.Vector3.Zero;
     member.PhysScene.DetailLog("{0},BSLinkInfoConstraint.ResetLink", member.LocalID);
 }
开发者ID:CassieEllen,项目名称:opensim,代码行数:34,代码来源:BSLinksetConstraints.cs

示例10: Set

 public IVariable Set(IMilpManager milpManager, ConstraintType type, IVariable leftVariable,
     IVariable rightVariable)
 {
     switch (type)
     {
         case ConstraintType.Equal:
             milpManager.SetEqual(leftVariable, rightVariable);
             leftVariable.ConstantValue = rightVariable.ConstantValue ?? leftVariable.ConstantValue;
             rightVariable.ConstantValue = leftVariable.ConstantValue ?? rightVariable.ConstantValue;
             break;
         case ConstraintType.LessOrEqual:
             milpManager.SetLessOrEqual(leftVariable, rightVariable);
             break;
         case ConstraintType.GreaterOrEqual:
             milpManager.SetGreaterOrEqual(leftVariable, rightVariable);
             break;
         case ConstraintType.LessThan:
             milpManager.Operation(OperationType.IsLessThan, leftVariable, rightVariable)
                 .Set(ConstraintType.Equal, milpManager.FromConstant(1));
             break;
         case ConstraintType.GreaterThan:
             milpManager.Operation(OperationType.IsGreaterThan, leftVariable, rightVariable)
                 .Set(ConstraintType.Equal, milpManager.FromConstant(1));
             break;
         case ConstraintType.NotEqual:
             milpManager.Operation(OperationType.IsNotEqual, leftVariable, rightVariable)
                 .Set(ConstraintType.Equal, milpManager.FromConstant(1));
             break;
         default:
             throw new InvalidOperationException("Cannot set constraint");
     }
     return leftVariable;
 }
开发者ID:afish,项目名称:MilpManager,代码行数:33,代码来源:CanonicalConstraintCalculator.cs

示例11: ConstraintAttribute

        public ConstraintAttribute(ConstraintType type)
        {
            if (type == ConstraintType.ForeignKey)
                throw new NotImplementedException();

            Type = type;
        }
开发者ID:deveel,项目名称:deveeldb,代码行数:7,代码来源:ConstraintAttribute.cs

示例12: ConstraintMapInfo

 internal ConstraintMapInfo(MemberInfo member, string columnName, ConstraintType constraintType, string checkExpression)
 {
     Member = member;
     ColumnName = columnName;
     ConstraintType = constraintType;
     CheckExpression = checkExpression;
 }
开发者ID:deveel,项目名称:deveeldb,代码行数:7,代码来源:ConstraintMapInfo.cs

示例13: Set

        public IVariable Set(IMilpManager milpManager, ConstraintType type, IVariable leftVariable, IVariable rightVariable)
        {
            IVariable any = milpManager.CreateAnonymous(Domain.AnyInteger);
            leftVariable.Set(ConstraintType.Equal,any.Operation(OperationType.Multiplication, rightVariable));

            return leftVariable;
        }
开发者ID:afish,项目名称:MilpManager,代码行数:7,代码来源:MultipleOfCalculator.cs

示例14: CheckFirebird

 private void CheckFirebird(DataTable dt, ConstraintType constraintType)
 {
     if (constraintType == ConstraintType.PrimaryKey && !dt.Columns.Contains(Key)) Key = "PK_NAME";
     if (constraintType == ConstraintType.ForeignKey && !dt.Columns.Contains(Key)) Key = "UK_NAME";
     if (!dt.Columns.Contains(RefersToTableKey)) RefersToTableKey = "REFERENCED_TABLE_NAME";
     //a firebird typo!
     if (dt.Columns.Contains("CHECK_CLAUSULE")) ExpressionKey = "CHECK_CLAUSULE";
 }
开发者ID:Petran15,项目名称:dbschemareader,代码行数:8,代码来源:ConstraintKeyMap.cs

示例15: SqlqueryCondition

 /// <summary>
 /// SqlQuery条件类构造函数
 /// </summary>
 /// <param name="ctype">查询类型,包括:Where、And、Or</param>
 /// <param name="columnname">条件列名</param>
 /// <param name="cparsion">条件表达式类型</param>
 /// <param name="value">条件值</param>
 /// <param name="isParentheses">是否加左括号</param>
 public SqlqueryCondition(ConstraintType ctype, string columnname, Comparison cparsion, object value, bool isParentheses = false)
 {
     SQConstraintType = ctype;
     SQColumnName = columnname;
     SQComparison = cparsion;
     SQValue = value;
     IsParentheses = isParentheses;
 }
开发者ID:lboobl,项目名称:RapidSolution,代码行数:16,代码来源:ConditionHelper.cs


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