public Base generatePaperBase(String type) { Base paperBase = new Base(0, 0, type); if (type == "bottom") { for (int i = 0; i < this.ribNum; i++) { int after = i + 1; if (i == this.ribNum) { after = 0; } DCHalfEdge outerBottomCircle = new DCHalfEdge( new CompPoint(xMainTop[rib.bottomNotchPos][i], zMainTop[rib.bottomNotchPos][i]), new CompPoint( xMainTop[rib.bottomNotchPos][after], zMainTop[rib.bottomNotchPos][after])); paperBase.addHalfEdge(outerBottomCircle); } double tabWidth = -50; paperBase.largeTabs(tabWidth); paperBase.generateHole(bottomHoleWidth / 2); } if (type == "top") { for (int i = 0; i < this.ribNum; i++) { int after = i + 1; if (i == this.ribNum) { after = 0; } DCHalfEdge outerTopCircle = new DCHalfEdge( new CompPoint(xMainTop[rib.topNotchPos][i], zMainTop[rib.topNotchPos][i]), new CompPoint(xMainTop[rib.topNotchPos][after], zMainTop[rib.topNotchPos][after])); paperBase.addHalfEdge(outerTopCircle); } double tabWidth = -50; paperBase.largeTabs(tabWidth); paperBase.generateHole(topHoleWidth / 2); } return paperBase; }
public DoublyConnectedEdgeList[] renderLamp() { /*need to calc width and height */ shade = new Shade(0, maxHeight); rib = new Rib(0, maxHeight); bottomBase = new Base(0, 0, "bottom"); topBase = new Base(0, 0, "top"); calculateDimensions(); generateRib(); generateShade(); shade.translate(myParent.width / 2, myParent.height / 2); // add notches rib.addNotches(notchWidth, notchHeight, ribNotchOffset, topCirclePos, bottomCirclePos); calculateDimensions(); generateBases(ribNum); bottomBase.addNotches(notchWidth * 2, notchHeight, ribNotchOffset, ribNum, false); topBase.addNotches(notchWidth * 2, notchHeight, ribNotchOffset, ribNum, false); bottomBase.generateHole(bottomHoleWidth); topBase.generateHole(topHoleWidth); rib.translate(myParent.width / 2, 0); // return all parts Part[] borders = new Part[4]; borders[0] = shade; borders[1] = rib; borders[2] = topBase; borders[3] = bottomBase; return borders; }