コード例 #1
0
ファイル: MarkGeometriesWrapper.cs プロジェクト: AdilGM/2DCAD
        public MarkGeometriesWrapper(IMarkGeometry[] geometries)
        {
            foreach (var geometry in geometries)
            {
                if (geometry is MarkGeometryPoint point)
                {
                    Points.Add(point);
                }
                else if (geometry is MarkGeometryLine line)
                {
                    Lines.Add(line);
                }
                else if (geometry is MarkGeometryPath path)
                {
                    Paths.Add(path);
                }
                else if (geometry is MarkGeometryArc arc)
                {
                    Arcs.Add(arc);
                }
                else if (geometry is MarkGeometryCircle circle)
                {
                    Circles.Add(circle);
                }
            }

            Update();
        }
コード例 #2
0
        public int RangeToShipBySector(GenericShip anotherShip, ArcType arcType)
        {
            GenericArc  arc     = Arcs.First(n => n.ArcType == arcType);
            ShotInfoArc arcInfo = new ShotInfoArc(HostShip, anotherShip, arc);

            return(arcInfo.Range);
        }
コード例 #3
0
        /// <summary>
        /// Добавление дуги
        /// </summary>
        /// <param name="fromID">ID вершины, откуда идёт дуга</param>
        /// <param name="arcName">Имя дуги</param>
        /// <param name="toID">ID вершины, куда идёт дуга</param>
        public Arc AddArc(int fromID, string arcName, int toID)
        {
            var fromNode = Mota(fromID);
            var toNode   = Mota(toID);

            if (ArcExists(fromID, arcName, toID))
            {
                throw new ArgumentException(string.Format("Между вершинами {0} и {1} " +
                                                          "уже есть дуга {2}",
                                                          fromNode.Name, toNode.Name, arcName));
            }
            if (fromID == toID)
            {
                throw new ArgumentException("Нельзя ссылаться на себя");
            }
            //Добавляем дугу в список
            var arc = new Arc
            {
                From = fromNode.ID,
                Name = arcName.Trim(),
                To   = toNode.ID
            };

            Arcs.Add(arc);
            IsChanged = true;
            return(arc);
        }
コード例 #4
0
ファイル: RotationManager.cs プロジェクト: eleanory808/ApsimX
        private void OnDoManagement(object sender, EventArgs e)
        {
            bool more = true;

            while (more)
            {
                more = false;
                double     bestScore = -1.0;
                RuleAction bestArc   = null;
                foreach (var arc in Arcs.FindAll(arc => arc.SourceName == CurrentState))
                {
                    double score = 1;
                    foreach (string testCondition in arc.Conditions)
                    {
                        object value = FindByPath(testCondition)?.Value;
                        if (value == null)
                        {
                            throw new Exception($"Test condition '{testCondition}' returned nothing");
                        }
                        score *= Convert.ToDouble(value, CultureInfo.InvariantCulture);
                    }
                    if (score > bestScore)
                    {
                        bestScore = score;
                        bestArc   = arc;
                    }
                }
                if (bestScore > 0.0)
                {
                    TransitionTo(bestArc);
                    more = true;
                }
            }
        }
コード例 #5
0
 /// <summary>
 /// Получает список вершин, из которых можно попасть в данную вершину nodeID по
 /// данной дуге arcName. Список может оказаться пустым.
 /// </summary>
 /// <param name="nodeID">ID вершины, куда хотим попасть</param>
 /// <param name="arcName">имя дуги</param>
 /// <returns></returns>
 public List <Node> GetNodesDirectedToMe(int nodeID, string arcName)
 {
     return(Arcs
            .Where(x => x.To == nodeID &&
                   x.Name.Trim().ToUpper() == arcName.Trim().ToUpper())
            .Select(x => Mota(x.From)).ToList());
 }
コード例 #6
0
        /// <summary>
        /// Для неименованной вершины nodeID находит самого верхнего предка по дугам is_a и is_instance
        /// и возвращает имя дуги, которой этот предок связан с вершиной System
        /// </summary>
        /// <param name="nodeID">ID вершины</param>
        /// <returns>имя дуги, которой предок связан с вершиной System</returns>
        public string OldestParentArc(int nodeID)
        {
            WayToSystemNodes = new List <Node>();
            WayToSystemArcs  = new List <Arc>();
            Node parentNode = Mota(nodeID);

            WayToSystemNodes.Add(parentNode);
            if (ArcExists(parentNode.ID, "#is_instance"))
            {
                WayToSystemArcs.Add(Arcs.Single(x => x.From == parentNode.ID && x.Name == "#is_instance"));
                parentNode = GetAttr(parentNode.ID, "#is_instance");
                WayToSystemNodes.Add(parentNode);
            }
            while (ArcExists(parentNode.ID, "#is_a"))
            {
                WayToSystemArcs.Add(Arcs.Single(x => x.From == parentNode.ID && x.Name == "#is_a"));
                parentNode = GetAttr(parentNode.ID, "#is_a");
                WayToSystemNodes.Add(parentNode);
            }
            var arcToSystem = GetArcsBetweenNodes(Atom("#System"), parentNode.ID).ToList();

            if (!arcToSystem.Any())
            {
                return(string.Empty);
            }
            if (arcToSystem.Count() > 1)
            {
                throw new ArgumentException("Между родителем и системной вершиной больше 1 дуги");
            }
            WayToSystemArcs.Add(Arcs.Single(x => x.From == Atom("#System") && x.Name == arcToSystem[0].Name && x.To == parentNode.ID));
            WayToSystemNodes.Add(Mota(Atom("#System")));
            return(arcToSystem[0].Name);
        }
コード例 #7
0
        private SvgPath CreateSlotPath()
        {
            var endCapRadius   = FastenerDiameter / 2f - Constants.Kerf;
            var innerArcRadius = Constants.JigHoleSpacing - (FastenerDiameter / 2f - Constants.Kerf);

            float innerArcX = innerArcRadius * DegreeTrig.Cos(startAngle);
            float innerArcY = -innerArcRadius *DegreeTrig.Sin(startAngle);  // y's are negative b/c they are above the origin hole

            float outerArcX = outerArcRadius * DegreeTrig.Cos(startAngle);
            float outerArcY = -outerArcRadius *DegreeTrig.Sin(startAngle);

            var pointA = Points.MetricPoint(-outerArcX, outerArcY);
            var pointB = Points.MetricPoint(outerArcX, outerArcY);
            var pointC = Points.MetricPoint(innerArcX, innerArcY);
            var pointD = Points.MetricPoint(-innerArcX, innerArcY);

            var slotPath = Paths.CutPath();

            var leftEndCap  = MakeEndCap(-innerArcX, innerArcY, -outerArcX, outerArcY);
            var rightEndCap = MakeEndCap(outerArcX, outerArcY, innerArcX, innerArcY);

            slotPath.PathData.Add(new SvgMoveToSegment(pointA));
            slotPath.PathData.Add(Arcs.SimpleSegment(pointA, outerArcRadius, SvgArcSweep.Positive, pointB));
            slotPath.PathData.Add(Arcs.SimpleSegment(pointB, endCapRadius, SvgArcSweep.Positive, pointC));
            slotPath.PathData.Add(Arcs.SimpleSegment(pointC, innerArcRadius, SvgArcSweep.Negative, pointD)); // Negative makes the lower arc path back "into" the body of the shape
            slotPath.PathData.Add(Arcs.SimpleSegment(pointD, endCapRadius, SvgArcSweep.Positive, pointA));
            return(slotPath);
        }
コード例 #8
0
        public bool IsShipInSector(GenericShip anotherShip, ArcType arcType)
        {
            GenericArc  arc     = Arcs.First(n => n.ArcType == arcType);
            ShotInfoArc arcInfo = new ShotInfoArc(HostShip, anotherShip, arc);

            return(arcInfo.IsShotAvailable);
        }
コード例 #9
0
        /// <summary>
        /// Adds arc
        /// </summary>
        /// <param name="arc">Arc for adding</param>
        /// <param name="index">Arc index</param>
        /// <exception cref="ArgumentOutOfRangeException"/>
        public void AddArc(Arc arc, int index = -1)
        {
            if (arc.StartVertex >= Vertices.Count)
            {
                throw new ArgumentOutOfRangeException(nameof(arc.StartVertex),
                                                      @"Index of the vertex must be a non-negative number less than the number of elements in the vertices list");
            }
            if (arc.EndVertex >= Vertices.Count)
            {
                throw new ArgumentOutOfRangeException(nameof(arc.EndVertex),
                                                      @"Index of the vertex must be a non-negative number less than the number of elements in the vertices list");
            }
            if (!Arcs.TrueForAll(arc1 => arc1.StartVertex != arc.StartVertex || arc1.EndVertex != arc.EndVertex))
            {
                throw new ArgumentOutOfRangeException(nameof(arc), @"The Arc already exists");
            }

            if (index == -1)
            {
                index = Arcs.Count;
            }
            Arcs.Insert(index, arc);

            ArcAdded?.Invoke(arc, new DigraphChangedEventArgs(index));
        }
コード例 #10
0
ファイル: FortunesAlgorithm.cs プロジェクト: jsgmu/cs633
        public void QueueInit()
        {
            //this.sweep = 0;
            //this.siteEvents = [];
            //var n = this.sites.length;
            //for (var i = 0; i < n; i++)
            //{
            //    var site = this.sites[i];
            //    this.queuePushSite({ type: this.SITE_EVENT, x: site.x, y: site.y, site: site});
            //}
            //this.NUM_SITES_PROCESSED = this.siteEvents.length;
            //this.circEvents = [];
            //this.arcs = [];
            //this.edges = [];
            //this.cells = {};

            sweep = 0;
            Sites.Clear();

            for (int i = 0; i < Input.Count; i++)
            {
                var site = Input[i];

                QueuePushSite(site);
            }

            CircleEvents.Clear();
            Arcs.Clear();
            Edges.Clear();
            Cells.Clear();
        }
コード例 #11
0
ファイル: MarkGeometriesWrapper.cs プロジェクト: AdilGM/2DCAD
 public void Clear()
 {
     Points.Clear();
     Lines.Clear();
     Arcs.Clear();
     Circles.Clear();
     Paths.Clear();
 }
コード例 #12
0
ファイル: RotationManager.cs プロジェクト: lie112/ApsimX
        private void OnDoManagement(object sender, EventArgs e)
        {
            bool more = true;

            while (more)
            {
                more = false;
                double     bestScore = -1.0;
                RuleAction bestArc   = null;
                foreach (var arc in Arcs.FindAll(arc => arc.SourceName == CurrentState))
                {
                    double score = 1;
                    foreach (string testCondition in arc.Conditions)
                    {
                        object value = FindByPath(testCondition)?.Value;
                        if (value == null)
                        {
                            throw new Exception($"Test condition '{testCondition}' returned nothing");
                        }
                        score *= Convert.ToDouble(value, CultureInfo.InvariantCulture);
                    }

                    if (Verbose)
                    {
                        string arcName = $"Transition from {arc.DestinationName} to {arc.DestinationName}";
                        string message;
                        if (score > 0)
                        {
                            if (score > bestScore)
                            {
                                message = $"{arcName} is possible and weight of {score} exceeds previous best weight of {bestScore}";
                            }
                            else
                            {
                                message = $"{arcName} is possible but weight of {score} does not exceed previous best weight of {bestScore}";
                            }
                        }
                        else
                        {
                            message = $"{arcName} is not possible. Weight = {score}";
                        }
                        summary.WriteMessage(this, message, MessageType.Diagnostic);
                    }

                    if (score > bestScore)
                    {
                        bestScore = score;
                        bestArc   = arc;
                    }
                }
                if (bestScore > 0.0)
                {
                    TransitionTo(bestArc);
                    more = true;
                }
            }
        }
コード例 #13
0
ファイル: Link.cs プロジェクト: tellma-ltd/XbrlWorkbench
        public void AddArc(Arc arc)
        {
            if (arc.Link != null)
            {
                throw new ArgumentException("The arc already belongs to a link.");
            }

            arc.Link = this;
            Arcs.Add(arc);

            Connect(arc);
        }
コード例 #14
0
 /// <summary>
 /// Получает вершину, куда можно попасть из данной вершины по данной дуге
 /// </summary>
 /// <param name="fromID">ID вершины, откуда выходит дуга</param>
 /// <param name="arcName">имя дуги</param>
 /// <returns></returns>
 public Node GetAttr(int fromID, string arcName)
 {
     try
     {
         var t = Arcs.SingleOrDefault(x => x.From == fromID &&
                                      x.Name.ToUpper() == arcName.Trim().ToUpper());
         return(t != null?Mota(t.To) : null);
     }
     catch (Exception e)
     {
         throw new ArgumentException(ErrMsg + e.Message);
     }
 }
コード例 #15
0
        public ShotInfoArc GetSectorInfo(GenericShip anotherShip, ArcType arcType)
        {
            GenericArc arc = Arcs.FirstOrDefault(n => n.ArcType == arcType);

            if (arc != null)
            {
                return(new ShotInfoArc(HostShip, anotherShip, arc));
            }
            else
            {
                return(null);
            }
        }
コード例 #16
0
        /// <summary>
        /// Removes arc from the list of digraph vertices
        /// </summary>
        /// <param name="index">Index of the arc in the list</param>
        /// <exception cref="ArgumentOutOfRangeException"/>
        public void RemoveArc(int index)
        {
            if (Arcs.Count <= index || index < 0)
            {
                throw new ArgumentOutOfRangeException(nameof(index),
                                                      @"Index of the arc must be a non-negative number less than the number of elements in the arcs list");
            }

            var removed = Arcs[index];

            Arcs.RemoveAt(index);

            ArcRemoved?.Invoke(removed, new DigraphChangedEventArgs(index));
        }
コード例 #17
0
ファイル: SectorsHolder.cs プロジェクト: jychuah/FlyCasual
        public bool IsShipInSector(GenericShip anotherShip, ArcType arcType)
        {
            GenericArc  arc     = Arcs.First(n => n.ArcType == arcType);
            ShotInfoArc arcInfo = new ShotInfoArc(HostShip, anotherShip, arc);

            bool result = arcInfo.IsShotAvailable;

            if (arcType == ArcType.Bullseye)
            {
                HostShip.CallOnBullseyeArcCheck(anotherShip, ref result);
            }

            return(result);
        }
コード例 #18
0
 /// <summary>
 /// Удаляет дугу с именем arcName, проходящую между вершинами from и to.
 /// </summary>
 /// <param name="fromID">ID вершины, откуда выходит дуга</param>
 /// <param name="arcName">Имя дуги</param>
 /// <param name="toID">ID вершины куда идёт дуга</param>
 public void DeleteArc(int fromID, string arcName, int toID)
 {
     try
     {
         var arcToRemove = Arcs.SingleOrDefault(x => x.From == fromID &&
                                                x.Name.Trim().ToUpper() == arcName.Trim().ToUpper() &&
                                                x.To == toID);
         Arcs.Remove(arcToRemove);
         IsChanged = true;
     }
     catch (Exception ex)
     {
         throw new ArgumentException(ErrMsg + ex.Message);
     }
 }
コード例 #19
0
ファイル: Piece.cs プロジェクト: jcambert/WeETL
        public Vector2 AddArc(string name, Vector2 start, Vector2 end, Vector2 center, AngleDirection orientation = AngleDirection.CCW)
        {
            var radius = Math.Min(Math.Abs((start - center).Modulus()), Math.Abs((end - center).Modulus()));

            double startAngle = orientation == AngleDirection.CCW? Vector2.Angle(start - center).ToDegree() : Vector2.Angle(end - center).ToDegree();
            double endAngle   = orientation == AngleDirection.CCW ? Vector2.Angle(end - center).ToDegree() : Vector2.Angle(start - center).ToDegree();

            var arc = new Arc(center, radius, startAngle, endAngle)
            {
                Comment = name
            };

            Arcs.Add(arc);
            return(end);
        }
コード例 #20
0
        public IQueryable <ArcEpisodes> FetchArcsWithEpisodes()
        {
            var list     = new List <Arc>();
            var parents  = Arcs.ToList();
            var children = Episodes.ToList();

            return(parents.GroupJoin(
                       children,
                       p => p.Id,
                       c => c.ArcId,
                       (arc, episodes) => new ArcEpisodes {
                Arc = arc, Episodes = episodes
            }
                       ).AsQueryable());
        }
コード例 #21
0
ファイル: liquid.cs プロジェクト: p0lar-bear/Prometheus
            public virtual void ReadChildData(BinaryReader reader)
            {
                int x = 0;

                _attachmentMarkerName.ReadString(reader);
                for (x = 0; (x < _arcs.Count); x = (x + 1))
                {
                    Arcs.Add(new LiquidArcBlockBlock());
                    Arcs[x].Read(reader);
                }
                for (x = 0; (x < _arcs.Count); x = (x + 1))
                {
                    Arcs[x].ReadChildData(reader);
                }
            }
コード例 #22
0
        /// <summary>
        /// Adds the specified Arc to the game board.
        /// </summary>
        public bool Push(Arc arc, Field field)
        {
            if (!field.ValidPlacement(arc))
            {
                return(false);
            }

            // Push the arc onto the field
            arc.Push(field);
            Arcs.Add(arc);

            // Notify the island set of connected nodes
            IslandSet.Connect(field);

            return(true);
        }
コード例 #23
0
        private void RenderPaths(GCodeFile file)
        {
            ClearPaths();

            foreach (var cmd in file.Commands)
            {
                if (cmd is GCodeLine)
                {
                    var gcodeLine = cmd as GCodeLine;
                    if (gcodeLine.Rapid)
                    {
                        RapidMoves.Add(new Line3D()
                        {
                            Start = gcodeLine.Start,
                            End   = gcodeLine.End
                        });
                    }
                    else
                    {
                        Lines.Add(new Line3D()
                        {
                            Start = gcodeLine.Start,
                            End   = gcodeLine.End
                        });
                    }
                }

                if (cmd is GCodeArc)
                {
                    var arc           = cmd as GCodeArc;
                    var segmentLength = arc.Length / 50;
                    var segments      = (cmd as GCodeArc).Split(segmentLength);
                    foreach (var segment in segments)
                    {
                        Arcs.Add(new Line3D()
                        {
                            Start = segment.Start,
                            End   = segment.End
                        });
                    }
                }
            }

            RaisePropertyChanged(nameof(Lines));
            RaisePropertyChanged(nameof(RapidMoves));
            RaisePropertyChanged(nameof(Arcs));
        }
コード例 #24
0
ファイル: Link.cs プロジェクト: tellma-ltd/XbrlWorkbench
        public virtual XElement ToXml()
        {
            var xLink = new XElement(ElementName,
                                     new XAttribute(XLinkXNames.Type, XLinkTypes.Extended),
                                     new XAttribute(XLinkXNames.Role, Role)
                                     );

            var xNodes = NodesMap.Values.Select(n => n.ToXml());

            xLink.Add(xNodes);

            var xArcs = Arcs.Select(a => a.ToXml());

            xLink.Add(xArcs);

            return(xLink);
        }
コード例 #25
0
        /// <summary>
        /// Удаление вершины
        /// </summary>
        /// <param name="nodeID">ID вершины</param>
        public void DeleteNode(int nodeID)
        {
            if (Nodes.All(x => x.ID != nodeID))
            {
                throw new ArgumentException(ErrMsg + "Мы пытаемся удалить несуществующую вершину");
            }
            //Удаляем входящие и исходящие дуги
            var arc = Arcs.Where(x => (x.From == nodeID || x.To == nodeID)).ToList();

            for (int i = arc.Count - 1; i >= 0; i--)
            {
                DeleteArc(arc[i]);
            }
            //удаляем вершину
            Nodes.Remove(Nodes.Single(x => x.ID == nodeID));
            IsChanged = true;
        }
コード例 #26
0
        /// <summary>
        /// Removes the specified Arc from the game board.
        /// </summary>
        public bool Pull(Arc arc)
        {
            if (arc.IsPulled)
            {
                return(false);
            }

            // Pull the arc from the field
            var field = arc.Field;

            arc.Pull();
            Arcs.Remove(arc);

            // Notify the island set of disconnected nodes
            IslandSet.Disconnect(field);

            return(true);
        }
コード例 #27
0
        public Graph(int count)
        {
            int number = 0;

            Points = Enumerable.Range(0, count).Select(i => new Point {
                Value = number++
            }).ToList();

            for (int i = 0; i < Points.Count; i++)
            {
                for (int j = i + 1; j < Points.Count; j++)
                {
                    if (!IsAlreadyArc(new Arc(Points[i], Points[j])))
                    {
                        Arcs.Add(new Arc(Points[i], Points[j]));
                    }
                }
            }
        }
コード例 #28
0
ファイル: Pointer.cs プロジェクト: DavidPx/McNaughtonJig
        public override void Create()
        {
            const float jigTopRadius = Constants.JigHoleSpacing + widthAboveRadiusHoles;
            const float cornerRadius = 3f;

            CreateRadiusHoles(out float pivotY); // pivotY is ~26mm

            Children.Add(Lines.EtchLine(0, -widthAboveRadiusHoles, 0, -(widthAboveRadiusHoles - guideLineLength)));

            var path = Paths.CutPath();

            var   pointA          = Points.MetricPoint(0, Constants.JigHoleSpacing + pivotY);
            float pointerCornersY = Constants.JigHoleSpacing + pivotY - rightSideWidth;
            var   pointB          = Points.MetricPoint(rightSideWidth, pointerCornersY);

            const float jigSweep  = 45f; // degrees of sweep the jig body will have
            var         angleBeta = Math.PI / 180f * (90 - jigSweep / 2);
            var         angleP    = Math.Acos(rightSideWidth / jigTopRadius) - angleBeta;
            var         n         = jigTopRadius * DegreeTrig.Sin(jigSweep / 2);

            var d = 2 * n * Math.Sin(angleP);
            var c = 2 * n * Math.Cos(angleP);

            var cY     = Constants.JigHoleSpacing - Math.Sqrt(Math.Pow(jigTopRadius, 2) - Math.Pow(rightSideWidth, 2));
            var pointC = Points.MetricPoint(rightSideWidth, (float)cY);

            var dX = -(c - rightSideWidth);
            var dY = cY + d;

            var pointD = Points.MetricPoint((float)dX, (float)dY);

            var pointE = Points.MetricPoint(-rightSideWidth, pointerCornersY);

            path.PathData.Add(new SvgMoveToSegment(pointA));
            path.PathData.Add(new SvgLineSegment(pointA, pointB));
            path.PathData.Add(new SvgLineSegment(pointB, pointC));
            path.PathData.Add(Arcs.SimpleSegment(pointC, jigTopRadius, SvgArcSweep.Negative, pointD));
            path.PathData.Add(new SvgLineSegment(pointD, pointE));
            path.PathData.Add(new SvgLineSegment(pointE, pointA));

            Children.Add(path);
        }
コード例 #29
0
        private void RenderPaths()
        {
            ClearPaths();

            foreach (var cmd in _file.Commands)
            {
                if (cmd is GCodeLine)
                {
                    var gcodeLine = cmd as GCodeLine;
                    if (gcodeLine.Rapid)
                    {
                        RapidMoves.Add(new Line3D()
                        {
                            Start = gcodeLine.Start,
                            End   = gcodeLine.End
                        });
                    }
                    else
                    {
                        Lines.Add(new Line3D()
                        {
                            Start = gcodeLine.Start,
                            End   = gcodeLine.End
                        });
                    }
                }

                if (cmd is GCodeArc)
                {
                    var gcodeArc = cmd as GCodeArc;
                    Arcs.Add(new Line3D()
                    {
                        Start = gcodeArc.Start,
                        End   = gcodeArc.End
                    });
                }
            }

            RaisePropertyChanged(nameof(Lines));
            RaisePropertyChanged(nameof(RapidMoves));
            RaisePropertyChanged(nameof(Arcs));
        }
コード例 #30
0
        private SvgVisualElement CreateOutline()
        {
            const float cornerRadius = 3f;

            var path = Paths.CutPath();

            var bottomY      = armThickness / 2;
            var rightBorderX = bodyRadius;

            // start drawing the path @ E.  E, F, G, A, B, C, D
            var pointE = Points.MetricPoint(rightBorderX, 0);
            var pointF = Points.MetricPoint(rightBorderX, bottomY - cornerRadius);
            var pointG = Points.MetricPoint(rightBorderX - cornerRadius, bottomY);

            path.PathData.Add(new SvgMoveToSegment(pointE));
            path.PathData.Add(new SvgLineSegment(pointE, pointF));
            path.PathData.Add(Arcs.SimpleSegment(pointF, cornerRadius, SvgArcSweep.Positive, pointG));

            if (armLength > 0)
            {
                float leftArmX = -bodyRadius - armLength + cornerRadius;
                var   pointA   = Points.MetricPoint(leftArmX, bottomY);
                var   pointB   = Points.MetricPoint(leftArmX, bottomY - armThickness);

                var dY     = bottomY - armThickness - cornerRadius;
                var dX     = -(float)Math.Sqrt(Math.Pow(bodyRadius, 2) - Math.Pow(dY, 2));
                var pointC = Points.MetricPoint(dX - cornerRadius, dY + cornerRadius);
                var pointD = Points.MetricPoint(dX, dY);

                path.PathData.Add(new SvgLineSegment(pointG, pointA));
                path.PathData.Add(Arcs.SimpleSegment(pointA, armThickness / 2, SvgArcSweep.Positive, pointB));
                path.PathData.Add(new SvgLineSegment(pointB, pointC));
                path.PathData.Add(Arcs.SimpleSegment(pointC, cornerRadius, SvgArcSweep.Negative, pointD));
                path.PathData.Add(Arcs.SimpleSegment(pointD, bodyRadius, SvgArcSweep.Positive, pointE));
            }
            // todo: else for zero arm



            return(path);
        }
コード例 #31
0
 //============================
 // Use this for initialization
 void Start()
 {
     currentArc = Arcs.Intro;
     behaviorAgent = new BehaviorAgent (this.InteractiveBehaviorTree());
     BehaviorManager.Instance.Register (behaviorAgent);
     behaviorAgent.StartBehavior ();
 }
コード例 #32
0
 protected Node setArc(Arcs set)
 {
     return new Sequence (
         new LeafInvoke (() => {currentArc = set;}),
         new LeafTrace ("Arc set to " + set)
     );
 }
コード例 #33
0
 protected Node SelectStoryById(Arcs arcID)
 {
     switch (arcID) {
     case Arcs.Intro:
         return this.IntroArc ();
     case Arcs.Round1:
         return this.Round1Arc ();
     case Arcs.Round2:
         return this.Round2Arc ();
     default:
         Debug.LogWarning("No arc selected. Default case occured.");
         return null;
     }
 }
コード例 #34
0
    protected Node SelectStoryArc(Arcs arcID)
    {
        return new SelectorParallel (
            new DecoratorLoop(new LeafAssert(() => {return (currentArc != arcID);})),

            this.SelectStoryById (arcID)

            );
    }