コード例 #1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="factory"></param>
 /// <param name="lines"></param>
 /// <param name="tolerance"></param>
 /// <param name="allowMultiEdges"></param>
 /// <param name="allowLoops"></param>
 /// <returns></returns>
 public static G CreateFromLineSegments <G, V, E>(this HeGraphFactoryBase <G, V, E> factory, IEnumerable <Line> lines, double tolerance = 1.0e-8, bool allowMultiEdges = false, bool allowLoops = false)
     where G : HeGraphBase <V, E>
     where V : HeVertex <V, E>, IVertex3d
     where E : Halfedge <V, E>
 {
     return(factory.CreateFromLineSegments(lines, (v, p) => v.Position = p, tolerance, allowMultiEdges, allowLoops));
 }
コード例 #2
0
        /// <summary>
        ///
        /// </summary>
        /// <typeparam name="G"></typeparam>
        /// <typeparam name="V"></typeparam>
        /// <typeparam name="E"></typeparam>
        /// <param name="factory"></param>
        /// <param name="lines"></param>
        /// <param name="setPosition"></param>
        /// <param name="tolerance"></param>
        /// <param name="allowMultiEdges"></param>
        /// <param name="allowLoops"></param>
        /// <returns></returns>
        public static G CreateFromLineSegments <G, V, E>(this HeGraphFactoryBase <G, V, E> factory, IEnumerable <Line> lines, Action <V, Vec3d> setPosition, double tolerance = 1.0e-8, bool allowMultiEdges = false, bool allowLoops = false)
            where G : HeGraphBase <V, E>
            where V : HeVertex <V, E>
            where E : Halfedge <V, E>
        {
            var pts = new List <Vec3d>();

            foreach (var ln in lines)
            {
                pts.Add(ln.From.ToVec3d());
                pts.Add(ln.To.ToVec3d());
            }

            return(factory.CreateFromLineSegments(pts, setPosition, tolerance, allowMultiEdges, allowLoops));
        }