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


C# Core.Vector2D类代码示例

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


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

示例1: Bone

 public Bone(string name)
 {
     m_refPosition = new Vector2D(0.0, 0.0);
     m_mat = Matrix3D.Identity.Clone();
     m_totalMat = Matrix3D.Identity.Clone();
     m_name = name;
 }
开发者ID:rollend,项目名称:LevelUp,代码行数:7,代码来源:Skeleton.cs

示例2: PointToAboveSegment

        public static bool PointToAboveSegment(Vector2D p, Segment seg, ref double distance)
        {
            double xMin = System.Math.Min(seg.P0.X, seg.P1.X);
            double xMax = System.Math.Max(seg.P0.X, seg.P1.X);

            if (p.X < xMin - MathFunctions.EpsilonF || p.X > xMax + MathFunctions.EpsilonF)
                return false;
            else
            {
                double yMin = System.Math.Min(seg.P0.Y, seg.P1.Y);
                double yMax = System.Math.Max(seg.P0.Y, seg.P1.Y);

                if (System.Math.Abs(seg.P1.X - seg.P0.X) < MathFunctions.EpsilonF)
                {
                    if (p.Y < yMin)
                        distance = yMin - p.Y;
                    else if (p.Y > yMax)
                        distance = yMax - p.Y;
                    else
                        distance = 0.0f;
                }
                else
                    distance = seg.P0.Y + (p.X - seg.P0.X) * (seg.P1.Y - seg.P0.Y) / (seg.P1.X - seg.P0.X) - p.Y;
                return true;
            }
        }
开发者ID:minrogi,项目名称:PLMPack,代码行数:26,代码来源:VerticalDistance.cs

示例3: DrawLine

 public void DrawLine(Vector2D v1, Vector2D v2, Color penColor)
 {
     Point[] pt = TransformPoint(new Vector2D[] { v1, v2 });
     System.Drawing.Graphics g = Graphics;
     Pen pen = new Pen(penColor);
     g.DrawLines(pen, pt);
 }
开发者ID:frozenflame83,项目名称:StackBuilder,代码行数:7,代码来源:Graphics2D.cs

示例4: CreateNewSegment

 public static PicSegment CreateNewSegment(uint id, PicGraphics.LT lType, Vector2D pt0, Vector2D pt1)
 {
     PicSegment segment = new PicSegment(id, lType);
     segment._pt0 = pt0;
     segment._pt1 = pt1;
     return segment;
 }
开发者ID:minrogi,项目名称:PLMPack,代码行数:7,代码来源:PicSegment.cs

示例5: PicCotationDistance

 protected PicCotationDistance(uint id, Vector2D pt0, Vector2D pt1, double offset, short noDecimals)
     : base(id, noDecimals)
 {
     _pt0 = pt0;
     _pt1 = pt1;
     _offset = offset;
 }
开发者ID:minrogi,项目名称:PLMPack,代码行数:7,代码来源:PicCotationDistance.cs

示例6: DrawRectangle

 public void DrawRectangle(Vector2D vMin, Vector2D vMax, Color penColor)
 {
     Point[] pt = TransformPoint(new Vector2D[] { vMin, vMax });
     System.Drawing.Graphics g = Graphics;
     Pen penRect = new Pen(penColor);
     g.DrawRectangle(penRect, pt[0].X, pt[0].Y, pt[1].X-pt[0].X, pt[1].Y-pt[0].Y);
 }
开发者ID:frozenflame83,项目名称:StackBuilder,代码行数:7,代码来源:Graphics2D.cs

示例7: Arc

 /// <summary>
 /// Initializes a new instance of the <see cref="Arc"/> class.
 /// </summary>
 /// <param name="pCenter">A <see cref="Vector2D"/> instance marking the <see cref="Arc"/>'s center point.</param>
 /// <param name="radius">The <see cref="Arc"/>'s radius.</param>
 /// <param name="angle0">The <see cref="Arc"/>'s starting angle.</param>
 /// <param name="angle1">The <see cref="Arc"/>'s ending angle.</param>
 public Arc(Vector2D pCenter, float radius, float angle0, float angle1)
 {
     _pCenter = pCenter;
     _radius = radius;
     _angle0 = angle0;
     _angle1 = angle1;
 }
开发者ID:minrogi,项目名称:PLMPack,代码行数:14,代码来源:Arc.cs

示例8: AddPosition

        public void AddPosition(LayerCyl layer, Vector2D vPosition)
        {
            Matrix4D matRot = Matrix4D.Identity;
            Vector3D vTranslation = Vector3D.Zero;

            if (_swapped)
            {
                matRot = new Matrix4D(
                    0.0, -1.0, 0.0, 0.0
                    , 1.0, 0.0, 0.0, 0.0
                    , 0.0, 0.0, 1.0, 0.0
                    , 0.0, 0.0, 0.0, 1.0
                    );
                vTranslation = new Vector3D(layer.PalletLength, 0.0, 0.0);
            }
            Transform3D transfRot = new Transform3D(matRot);

            matRot.M14 = vTranslation[0];
            matRot.M24 = vTranslation[1];
            matRot.M34 = vTranslation[2];

            Transform3D transfRotTranslation = new Transform3D(matRot);
            Vector3D vPositionSwapped = transfRotTranslation.transform(new Vector3D(vPosition.X, vPosition.Y, 0.0));

            if (!layer.IsValidPosition(new Vector2D(vPositionSwapped.X, vPositionSwapped.Y)))
            {
                _log.Warn(string.Format("Attempt to add an invalid position in pattern = {0}, Swapped = true", this.Name));
                return;
            }
            layer.Add(new Vector2D(vPositionSwapped.X, vPositionSwapped.Y));
        }
开发者ID:frozenflame83,项目名称:StackBuilder,代码行数:31,代码来源:CylinderLayerPattern.cs

示例9: Main

        static void Main(string[] args)
        {

            bool bestLayersOnly = true;
            Vector3D dimBox = new Vector3D(400.0, 300.0, 150.0);
            Vector2D dimContainer = new Vector2D(1200.0, 1000.0);
            ConstraintSetCasePallet constraintSet = new ConstraintSetCasePallet();
            constraintSet.SetMaxHeight(1200.0); 

            try
            {
                LayerSolver solver = new LayerSolver();
                List<Layer2D> layers = solver.BuildLayers(dimBox, dimContainer, constraintSet, bestLayersOnly);

                int solIndex = 0;
                foreach (Layer2D layer in layers)
                {
                    string fileName = string.Format("{0}_{1}.bmp", layer.Name, solIndex++);
                    string filePath = Path.Combine(Path.GetTempPath(), fileName);
                    Console.WriteLine(string.Format("Generating {0}...", filePath));

                    Graphics2DImage graphics = new Graphics2DImage( new Size(150, 150) );
                    SolutionViewerLayer solViewer = new SolutionViewerLayer(layer);
                    BoxProperties bProperties = new BoxProperties(null, 400.0, 300.0, 150.0);
                    bProperties.SetColor(Color.Brown);
                    solViewer.Draw(graphics, bProperties, 1500.0);
                    graphics.SaveAs(filePath);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
开发者ID:TimVelo,项目名称:StackBuilder,代码行数:34,代码来源:Program.cs

示例10: IsMiddleQuotation

 protected virtual bool IsMiddleQuotation(Vector2D pt2, Vector2D pt3, double textWidth, double textHeight)
 {
     double length = (pt3 - pt2).GetLength();
     if (Math.Abs(pt3.Y - pt2.Y) < (textHeight / textWidth) * Math.Abs(pt3.X - pt2.X))
         return Math.Abs((pt3 - pt2).X) > textWidth * _globalCotationProperties._lengthCoef;
     else
         return Math.Abs((pt3 - pt2).Y) > textHeight * _globalCotationProperties._lengthCoef;
 }
开发者ID:minrogi,项目名称:PLMPack,代码行数:8,代码来源:PicCotationDistance.cs

示例11: BuildLayers

        public List<Layer2D> BuildLayers(Vector3D dimBox, Vector2D dimContainer, ConstraintSetAbstract constraintSet, bool keepOnlyBest)
        {
            // instantiate list of layers
            List<Layer2D> listLayers0 = new List<Layer2D>();

            // loop through all patterns
            foreach (LayerPattern pattern in LayerPattern.All)
            {
                // loop through all orientation
                foreach (HalfAxis.HAxis axisOrtho in HalfAxis.All)
                {
                    // is orientation allowed
                    if ( !constraintSet.AllowOrientation(axisOrtho) )
                        continue;
                    // not swapped vs swapped pattern
                    for (int iSwapped = 0; iSwapped < 1; ++iSwapped)
                    {
                        // does swapping makes sense for this layer pattern ?
                        if (!pattern.CanBeSwapped && (iSwapped == 1))
                            continue;
                        // instantiate layer
                        Layer2D layer = new Layer2D(dimBox, dimContainer, axisOrtho, iSwapped == 1);
                        layer.PatternName = pattern.Name;
                        double actualLength = 0.0, actualWidth = 0.0;
                        if (!pattern.GetLayerDimensionsChecked(layer, out actualLength, out actualWidth))
                            continue;
                        pattern.GenerateLayer(layer, actualLength, actualWidth);
                        if (0 == layer.Count)
                            continue;
                        listLayers0.Add(layer);
                    }
                }
            }

            // keep only best layers
            if (keepOnlyBest)
            {
                // 1. get best count
                int bestCount = 0;
                foreach (Layer2D layer in listLayers0)
                    bestCount = Math.Max(layer.CountInHeight(constraintSet.OptMaxHeight.Value), bestCount);

                // 2. remove any layer that does not match the best count given its orientation
                List<Layer2D> listLayers1 = new List<Layer2D>();
                foreach (Layer2D layer in listLayers0)
                {
                    if (layer.CountInHeight(constraintSet.OptMaxHeight.Value) >= bestCount)
                        listLayers1.Add(layer);
                }
                // 3. copy back in original list
                listLayers0.Clear();
                listLayers0.AddRange(listLayers1);
            }
            if (constraintSet.OptMaxHeight.Activated)
                listLayers0.Sort(new LayerComparerCount(constraintSet.OptMaxHeight.Value));

            return listLayers0;
        }
开发者ID:TimVelo,项目名称:StackBuilder,代码行数:58,代码来源:LayerSolver.cs

示例12: CreateNewArc

 public static PicArc CreateNewArc(uint id, PicGraphics.LT lType, Vector2D center, double radius, double angleBeg, double angleEnd)
 {
     PicArc arc = new PicArc(id, lType);
     arc._center = center;
     arc._radius = radius;
     arc._angleBeg = angleBeg;
     arc._angleEnd = angleEnd;
     return arc;
 }
开发者ID:minrogi,项目名称:PLMPack,代码行数:9,代码来源:PicArc.cs

示例13: DrawLine

        public override void DrawLine(LT lineType, Vector2D ptBeg, Vector2D ptEnd)
        {
            _cb.SetLineWidth(0.0f);
            _cb.SetColorStroke(LineTypeToBaseColor(lineType));

            _cb.MoveTo(DX(ptBeg.X), DY(ptBeg.Y));
            _cb.LineTo(DX(ptEnd.X), DY(ptEnd.Y));
            _cb.Stroke();
        }
开发者ID:minrogi,项目名称:PLMPack,代码行数:9,代码来源:PicGraphicsPdf.cs

示例14: TransformPosition

        //����������ϵ�еĶ������ù����任���ֲ�����ϵ��
        public Vector2D TransformPosition(Vector2D refPos)
        {
            //�����������ϵ�е�����
            Vector2D relPos = GetRelPositon(refPos);
            Vector3D homoPos = new Vector3D(relPos.X, relPos.Y, 1.0);

            //�ӹ�������ϵ�任���ֲ�����ϵ
            Vector3D TransformedPos = Matrix3D.Transform(m_totalMat, homoPos);
            return new Vector2D(TransformedPos.X, TransformedPos.Y);
        }
开发者ID:rollend,项目名称:LevelUp,代码行数:11,代码来源:Skeleton.cs

示例15: GetOffsetPoints

            protected virtual void GetOffsetPoints(out Vector2D pt2, out Vector2D pt3)
            {
                // build normal
                Vector2D vI = (_pt1 - _pt0); vI.Normalize();
                Vector2D vJ = new Vector2D(vI.Y, -vI.X);
                double delta = -_globalCotationProperties._hrap;

                pt2 = new Vector2D(_pt0 + vJ * _offset + Math.Sign(_offset) * delta * vJ);
                pt3 = new Vector2D(_pt1 + vJ * _offset + Math.Sign(_offset) * delta * vJ);
            }
开发者ID:minrogi,项目名称:PLMPack,代码行数:10,代码来源:PicCotationDistance.cs


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