private static OnCurve CreateOuterTrimmingCurve( OnSurface s, int side // 0 = SW to SE // 1 = SE to NE // 2 = NE to NW // 3 = NW to SW ) { // A trimming curve is a 2d curve whose image lies in the surface's domain. // The "active" portion of the surface is to the left of the trimming curve. // An outer trimming loop consists of a simple closed curve running // counter-clockwise around the region it trims. //In cases when trim curve is not easily defined in surface domain, //use ON_Surface::Pullback only be careful about curve direction to ensure //loop trims run anti-clockwise for outer loop and clockwise for inner loop. //In this case, trim curves lie on the four edges of the surface On2dPoint from = new On2dPoint(); On2dPoint to = new On2dPoint(); double u0 = double.NaN, u1 = double.NaN, v0 = double.NaN, v1 = double.NaN; s.GetDomain(0, ref u0, ref u1); s.GetDomain(1, ref v0, ref v1); switch (side) { case 0: // SW to SE from.x = u0; from.y = v0; to.x = u1; to.y = v0; break; case 1: // SE to NE from.x = u1; from.y = v0; to.x = u1; to.y = v1; break; case 2: // NE to NW from.x = u1; from.y = v1; to.x = u0; to.y = v1; break; case 3: // NW to SW from.x = u0; from.y = v1; to.x = u0; to.y = v0; break; default: return(null); } OnCurve c2d = new OnLineCurve(from, to); if (c2d != null) { c2d.SetDomain(0.0, 1.0); } return(c2d); }
/// <summary> /// TwistedCubeEdgeCurve /// </summary> static OnCurve TwistedCubeEdgeCurve( IOn3dPoint from, IOn3dPoint to ) { // Creates a 3d line segment to be used as a 3d curve in a OnBrep OnLineCurve c3d = new OnLineCurve(from, to); c3d.SetDomain(0.0, 1.0); return(c3d); }
private static OnCurve CreateLinearCurve(On3dPoint from, On3dPoint to) { // creates a 3d line segment to be used as a 3d curve in a ON_Brep OnCurve c3d = new OnLineCurve(from, to); if (c3d != null) { c3d.SetDomain(0.0, 10.0); } return(c3d); }
/// <summary> /// TwistedCubeTrimmingCurve /// </summary> static OnCurve TwistedCubeTrimmingCurve( IOnSurface s, int side // 0 = SW to SE // 1 = SE to NE // 2 = NE to NW // 3 = NW to SW ) { // A trimming curve is a 2d curve whose image lies in the surface's domain. // The "active" portion of the surface is to the left of the trimming curve. // An outer trimming loop consists of a simple closed curve running // counter-clockwise around the region it trims. On2dPoint from = new On2dPoint(); On2dPoint to = new On2dPoint(); double u0 = 0.0, u1 = 0.0, v0 = 0.0, v1 = 0.0; s.GetDomain(0, ref u0, ref u1); s.GetDomain(1, ref v0, ref v1); switch (side) { case 0: // SW to SE from.x = u0; from.y = v0; to.x = u1; to.y = v0; break; case 1: // SE to NE from.x = u1; from.y = v0; to.x = u1; to.y = v1; break; case 2: // NE to NW from.x = u1; from.y = v1; to.x = u0; to.y = v1; break; case 3: // NW to SW from.x = u0; from.y = v1; to.x = u0; to.y = v0; break; default: return(null); } OnLineCurve c2d = new OnLineCurve(from, to); c2d.SetDomain(0.0, 1.0); return(c2d); }
private static OnCurve CreateTrimmingCurve( OnSurface s, int side // 0 = SW to SE // 1 = SE to NE // 2 = NE to NW // 3 = NW to SW ) { // A trimming curve is a 2d curve whose image lies in the surface's domain. // The "active" portion of the surface is to the left of the trimming curve. // An outer trimming loop consists of a simple closed curve running // counter-clockwise around the region it trims. // An inner trimming loop consists of a simple closed curve running // clockwise around the region the hole. On2dPoint from = new On2dPoint(); On2dPoint to = new On2dPoint(); double u0 = double.NaN, u1 = double.NaN, v0 = double.NaN, v1 = double.NaN; s.GetDomain(0, ref u0, ref u1); s.GetDomain(1, ref v0, ref v1); switch (side) { case 0: // SW to SE from.x = u0; from.y = v0; to.x = u1; to.y = v0; break; case 1: // diagonal from.x = u1; from.y = v0; to.x = (u0 + u1) / 2; to.y = v1; break; case 2: // diagonal from.x = (u0 + u1) / 2; from.y = v1; to.x = u0; to.y = v0; break; default: return(null); } OnCurve c2d = new OnLineCurve(from, to); if (c2d != null) { c2d.SetDomain(0.0, 1.0); } return(c2d); }
/// <summary> /// TwistedCubeTrimmingCurve /// </summary> static OnCurve TwistedCubeTrimmingCurve( IOnSurface s, int side // 0 = SW to SE // 1 = SE to NE // 2 = NE to NW // 3 = NW to SW ) { // A trimming curve is a 2d curve whose image lies in the surface's domain. // The "active" portion of the surface is to the left of the trimming curve. // An outer trimming loop consists of a simple closed curve running // counter-clockwise around the region it trims. On2dPoint from = new On2dPoint(); On2dPoint to = new On2dPoint(); double u0 = 0.0, u1 = 0.0, v0 = 0.0, v1 = 0.0; s.GetDomain(0, ref u0, ref u1); s.GetDomain(1, ref v0, ref v1); switch (side) { case 0: // SW to SE from.x = u0; from.y = v0; to.x = u1; to.y = v0; break; case 1: // SE to NE from.x = u1; from.y = v0; to.x = u1; to.y = v1; break; case 2: // NE to NW from.x = u1; from.y = v1; to.x = u0; to.y = v1; break; case 3: // NW to SW from.x = u0; from.y = v1; to.x = u0; to.y = v0; break; default: return null; } OnLineCurve c2d = new OnLineCurve(from, to); c2d.SetDomain(0.0, 1.0); return c2d; }
/// <summary> /// TwistedCubeEdgeCurve /// </summary> static OnCurve TwistedCubeEdgeCurve( IOn3dPoint from, IOn3dPoint to ) { // Creates a 3d line segment to be used as a 3d curve in a OnBrep OnLineCurve c3d = new OnLineCurve(from, to); c3d.SetDomain(0.0, 1.0); return c3d; }
private static OnCurve CreateLinearCurve(On3dPoint from, On3dPoint to) { // creates a 3d line segment to be used as a 3d curve in a ON_Brep OnCurve c3d = new OnLineCurve(from, to); if (c3d != null) c3d.SetDomain(0.0, 10.0); return c3d; }
private static OnCurve CreateOuterTrimmingCurve( OnSurface s, int side // 0 = SW to SE // 1 = SE to NE // 2 = NE to NW // 3 = NW to SW ) { // A trimming curve is a 2d curve whose image lies in the surface's domain. // The "active" portion of the surface is to the left of the trimming curve. // An outer trimming loop consists of a simple closed curve running // counter-clockwise around the region it trims. //In cases when trim curve is not easily defined in surface domain, //use ON_Surface::Pullback only be careful about curve direction to ensure //loop trims run anti-clockwise for outer loop and clockwise for inner loop. //In this case, trim curves lie on the four edges of the surface On2dPoint from = new On2dPoint(); On2dPoint to = new On2dPoint(); double u0 = double.NaN, u1 = double.NaN, v0 = double.NaN, v1 = double.NaN; s.GetDomain(0, ref u0, ref u1); s.GetDomain(1, ref v0, ref v1); switch (side) { case 0: // SW to SE from.x = u0; from.y = v0; to.x = u1; to.y = v0; break; case 1: // SE to NE from.x = u1; from.y = v0; to.x = u1; to.y = v1; break; case 2: // NE to NW from.x = u1; from.y = v1; to.x = u0; to.y = v1; break; case 3: // NW to SW from.x = u0; from.y = v1; to.x = u0; to.y = v0; break; default: return null; } OnCurve c2d = new OnLineCurve(from, to); if (c2d != null) c2d.SetDomain(0.0, 1.0); return c2d; }
//Trim curves must run is clockwise direction private static OnCurve CreateInnerTrimmingCurve( OnSurface s, int side // 0 = near SE to SW // 1 = near SW to NW // 2 = near NW to NE // 3 = near NE to SE ) { // A trimming curve is a 2d curve whose image lies in the surface's domain. // The "active" portion of the surface is to the left of the trimming curve. // An inner trimming loop consists of a simple closed curve running // clockwise around the region the hole. //In this case, trim curves lie with 0.2 domain distance from surface edge On2dPoint from = new On2dPoint(); On2dPoint to = new On2dPoint(); double u0 = double.NaN, u1 = double.NaN, v0 = double.NaN, v1 = double.NaN; s.GetDomain(0, ref u0, ref u1); s.GetDomain(1, ref v0, ref v1); double udis = 0.2 * (u1 - u0); double vdis = 0.2 * (v1 - v0); u0 += udis; u1 -= udis; v0 += vdis; v1 -= vdis; switch (side) { case 0: // near SE to SW from.x = u1; from.y = v0; to.x = u0; to.y = v0; break; case 1: // near SW to NW from.x = u0; from.y = v0; to.x = u0; to.y = v1; break; case 2: // near NW to NE from.x = u0; from.y = v1; to.x = u1; to.y = v1; break; case 3: // near NE to SE from.x = u1; from.y = v1; to.x = u1; to.y = v0; break; default: return null; } OnCurve c2d = new OnLineCurve(from, to); if (c2d != null) c2d.SetDomain(0.0, 1.0); return c2d; }
//Trim curves must run is clockwise direction private static OnCurve CreateInnerTrimmingCurve( OnSurface s, int side // 0 = near SE to SW // 1 = near SW to NW // 2 = near NW to NE // 3 = near NE to SE ) { // A trimming curve is a 2d curve whose image lies in the surface's domain. // The "active" portion of the surface is to the left of the trimming curve. // An inner trimming loop consists of a simple closed curve running // clockwise around the region the hole. //In this case, trim curves lie with 0.2 domain distance from surface edge On2dPoint from = new On2dPoint(); On2dPoint to = new On2dPoint(); double u0 = double.NaN, u1 = double.NaN, v0 = double.NaN, v1 = double.NaN; s.GetDomain(0, ref u0, ref u1); s.GetDomain(1, ref v0, ref v1); double udis = 0.2 * (u1 - u0); double vdis = 0.2 * (v1 - v0); u0 += udis; u1 -= udis; v0 += vdis; v1 -= vdis; switch (side) { case 0: // near SE to SW from.x = u1; from.y = v0; to.x = u0; to.y = v0; break; case 1: // near SW to NW from.x = u0; from.y = v0; to.x = u0; to.y = v1; break; case 2: // near NW to NE from.x = u0; from.y = v1; to.x = u1; to.y = v1; break; case 3: // near NE to SE from.x = u1; from.y = v1; to.x = u1; to.y = v0; break; default: return(null); } OnCurve c2d = new OnLineCurve(from, to); if (c2d != null) { c2d.SetDomain(0.0, 1.0); } return(c2d); }