示例#1
0
            /// <summary>
            /// Get the node relevant for a specific location on the line
            /// segment's original path.
            /// </summary>
            /// <param name="t">The location on the original path to query.</param>
            /// <param name="left">The diced node left of the location queried.</param>
            /// <param name="right">The diced node right of the location queried.</param>
            /// <returns>Information on the diced state and the output parameters.</returns>
            public SplitResult GetNode(float t, out Utils.NodeTPos left, out Utils.NodeTPos right)
            {
                if (t < 0.0f || t > 1.0f)
                {
                    left  = new Utils.NodeTPos(null, t);
                    right = new Utils.NodeTPos(null, t);
                    return(SplitResult.OnBoundary);
                }

                if (splits.Count < 2)
                {
                    left  = this.splits[0];
                    right = this.splits[0];
                    return(SplitResult.OnlyOne);
                }

                for (int i = 0; i < splits.Count; ++i)
                {
                    if (splits[i].t == t)
                    {
                        left  = this.splits[i];
                        right = this.splits[i];
                        return(SplitResult.OnBoundary);
                    }
                    else if (this.splits[i].t > t)
                    {
                        left  = this.splits[i - 1];
                        right = this.splits[i];
                        return(SplitResult.Between);
                    }
                }

                left  = this.splits[this.splits.Count - 2];
                right = this.splits[this.splits.Count - 1];
                return(SplitResult.End);
            }
示例#2
0
 /// <summary>
 /// Add a diced entry.
 /// </summary>
 /// <param name="ntp">The entry information.</param>
 /// <returns>True if successful. Else, false. Adding an entry will fail
 /// if the t location is out of bounds or already claimed.</returns>
 public bool AddEntry(Utils.NodeTPos ntp)
 {
     return(this.AddEntry(ntp.t, ntp.node));
 }
示例#3
0
 /// <summary>
 /// Get the previous dice segment to a specified segment.
 /// </summary>
 /// <param name="ntp">The segment to get the previous neighbor in respect to.</param>
 /// <returns>The previous diced segment neighbor in respect to ntp.</returns>
 public BNode GetPreviousTo(Utils.NodeTPos ntp)
 {
     return(this.GetPreviousTo(ntp.node, ntp.t));
 }
示例#4
0
 /// <summary>
 /// Get the dice segment after a specified segment.
 /// </summary>
 /// <param name="ntp">The segment to get the neighbor after.</param>
 /// <returns>The diced node after the specified original node and location in it.</returns>
 public BNode GetNextTo(Utils.NodeTPos ntp)
 {
     return(this.GetNextTo(ntp.node, ntp.t));
 }