public void Generate() { poly = WatermanPoly.Build(1f, root, c, MergeFaces); if (ApplyOps) { var o1 = new OpParams { valueA = op1Amount1, valueB = op1Amount2, facesel = op1Facesel }; poly = poly.ApplyOp(op1, o1); var o2 = new OpParams { valueA = op2Amount1, valueB = op2Amount2, facesel = op2Facesel }; poly = poly.ApplyOp(op2, o2); } if (Canonicalize) { poly = poly.Canonicalize(0.1, 0.1); } poly = poly.Transform(Position, Rotation, Scale); var mesh = PolyMeshBuilder.BuildMeshFromConwayPoly(poly, false, Colors, ColorMethod); GetComponent <MeshFilter>().mesh = mesh; }
public void Build(int p, int q) { P = p; Q = q; switch (ShapeType) { case PolyHydraEnums.ShapeTypes.Uniform: var wythoff = new WythoffPoly(PolyType, P, Q); wythoff.BuildFaces(); poly = new ConwayPoly(wythoff); break; case PolyHydraEnums.ShapeTypes.Johnson: poly = JohnsonPoly.Build(JohnsonPolyType, P); break; case PolyHydraEnums.ShapeTypes.Grid: poly = Grids.Grids.MakeGrid(GridType, GridShape, P, Q); break; case PolyHydraEnums.ShapeTypes.Other: poly = JohnsonPoly.BuildOther(OtherPolyType, P, Q); break; case PolyHydraEnums.ShapeTypes.Waterman: poly = WatermanPoly.Build(1f, P, Q, true); break; } }
public void MakePolyhedron() { switch (ShapeType) { case PolyHydraEnums.ShapeTypes.Uniform: var wythoff = new WythoffPoly(UniformPolyType, PrismP, PrismQ); wythoff.BuildFaces(); _conwayPoly = new ConwayPoly(wythoff); break; case PolyHydraEnums.ShapeTypes.Johnson: _conwayPoly = JohnsonPoly.Build(JohnsonPolyType, PrismP); break; case PolyHydraEnums.ShapeTypes.Grid: _conwayPoly = Grids.Grids.MakeGrid(GridType, GridShape, PrismP, PrismQ); break; case PolyHydraEnums.ShapeTypes.Waterman: _conwayPoly = WatermanPoly.Build(PrismP, PrismQ); break; case PolyHydraEnums.ShapeTypes.Other: _conwayPoly = JohnsonPoly.BuildOther(OtherPolyType, PrismP, PrismQ); break; } _conwayPoly.basePolyhedraInfo = new ConwayPoly.BasePolyhedraInfo { P = PrismP, Q = PrismQ }; foreach (var op in ConwayOperators.ToList()) { if (op.disabled || op.opType == Ops.Identity) { continue; } _conwayPoly = ApplyOp(_conwayPoly, ref stashed, op); _conwayPoly.basePolyhedraInfo = new ConwayPoly.BasePolyhedraInfo { P = PrismP, Q = PrismQ }; } var mesh = PolyMeshBuilder.BuildMeshFromConwayPoly(_conwayPoly, GenerateSubmeshes, null, ColorMethod); AssignFinishedMesh(mesh); }