/// <summary> /// this function converts all the 3d polyines to 2d lines so we can process everything /// This is the equivanlant of a 3d->2d projection function /// </summary> /// <param name="sp"></param> /// <returns></returns> private List <Line2d> Get2dLines(SliceBuildConfig sp, List <PolyLine3d> segments) { List <Line2d> lst = new List <Line2d>(); foreach (PolyLine3d ply in segments) { if (ply == null) { continue; } for (int c = 0; c < ply.m_points.Count - 1; c++) { Line2d ln = new Line2d(); ln.SetParent(ply); //get the 3d points of the line Point3d p3d1 = (Point3d)ply.m_points[c]; Point3d p3d2 = (Point3d)ply.m_points[c + 1]; //convert them to 2d (probably should add an offset to center them) ln.p1.x = (int)(p3d1.x * sp.dpmmX); ln.p1.y = (int)(p3d1.y * sp.dpmmY); ln.p2.x = (int)(p3d2.x * sp.dpmmX); ln.p2.y = (int)(p3d2.y * sp.dpmmY); lst.Add(ln); } } return(lst); // return the list }
/// <summary> /// this function converts all the 3d polyines to 2d lines so we can process everything /// This is the equivanlant of a 3d->2d projection function /// </summary> /// <param name="sp"></param> /// <returns></returns> private List <Line2d> Get2dLines(SliceBuildConfig sp, List <PolyLine3d> segments) { List <Line2d> lst = new List <Line2d>(); // this can be changed at some point to assume that the 3d polyline has more than 2 points // I'll need to do this when I want to properly generate inside / outside countours foreach (PolyLine3d ply in segments) { Line2d ln = new Line2d(); ln.SetParent(ply); //get the 3d points of the line Point3d p3d1 = (Point3d)ply.m_points[0]; Point3d p3d2 = (Point3d)ply.m_points[1]; //convert them to 2d (probably should add an offset to center them) ln.p1.x = (int)(p3d1.x * sp.dpmmX); // +hxres; ln.p1.y = (int)(p3d1.y * sp.dpmmY); // +hyres; ln.p2.x = (int)(p3d2.x * sp.dpmmX); // +hxres; ln.p2.y = (int)(p3d2.y * sp.dpmmY); // +hyres; lst.Add(ln); } return(lst); // return the list }
/// <summary> /// this function converts all the 3d polyines to 2d lines so we can process everything /// This is the equivanlant of a 3d->2d projection function /// </summary> /// <param name="sp"></param> /// <returns></returns> private List<Line2d> Get2dLines(SliceBuildConfig sp, List<PolyLine3d> segments) { List<Line2d> lst = new List<Line2d>(); // this can be changed at some point to assume that the 3d polyline has more than 2 points // I'll need to do this when I want to properly generate inside / outside countours foreach (PolyLine3d ply in segments) { Line2d ln = new Line2d(); ln.SetParent(ply.m_plyderived); //get the 3d points of the line Point3d p3d1 = (Point3d)ply.m_points[0]; Point3d p3d2 = (Point3d)ply.m_points[1]; //convert them to 2d (probably should add an offset to center them) ln.p1.x = (int)(p3d1.x * sp.dpmmX);// +hxres; ln.p1.y = (int)(p3d1.y * sp.dpmmY);// +hyres; ln.p2.x = (int)(p3d2.x * sp.dpmmX);// +hxres; ln.p2.y = (int)(p3d2.y * sp.dpmmY);// +hyres; lst.Add(ln); } return lst; // return the list }
/// <summary> /// this function converts all the 3d polyines to 2d lines so we can process everything /// This is the equivanlant of a 3d->2d projection function /// </summary> /// <param name="sp"></param> /// <returns></returns> private List<Line2d> Get2dLines(SliceBuildConfig sp, List<PolyLine3d> segments) { List<Line2d> lst = new List<Line2d>(); foreach (PolyLine3d ply in segments) { for (int c = 0; c < ply.m_points.Count - 1; c++ ) { Line2d ln = new Line2d(); ln.SetParent(ply); //get the 3d points of the line Point3d p3d1 = (Point3d)ply.m_points[c]; Point3d p3d2 = (Point3d)ply.m_points[c + 1]; //convert them to 2d (probably should add an offset to center them) ln.p1.x = (int)(p3d1.x * sp.dpmmX); ln.p1.y = (int)(p3d1.y * sp.dpmmY); ln.p2.x = (int)(p3d2.x * sp.dpmmX); ln.p2.y = (int)(p3d2.y * sp.dpmmY); lst.Add(ln); } } return lst; // return the list }