IGeo+ControlP5 update

Hi, I have an issue with a sketch in which I use a ControlP5 interface to modify iGeo geometries. I have 3 IGeo ICurves, each one can translate individually on X and Y axis with Cp5 sliders, and then I use these curves to make an ILoft surface. When I change the values with the slider the sketch automatically draw the 3 ICurves and make the ILoft, but the problem is that the previous one doesn't disappear, so I have all the curves and surfaces overlapped in the screen. I have already looked for the solution in the forum and some people could resolve the problem calling background (0,0,0); in void draw(). I tried to use the same solution with IGeo background call IG.bg(0); but I did't get any result. All the operation related to geometry variations are made inside the public void controlEvent method, in void draw() there is only the background calling. Anyone can help me? Thanks in advance!

Answers

  • edited July 2015

    Solution from Supershape 3D by Nathan Miller

    public void refpiGeon() {
      IPoint [] ptarr = IG.points();
      ICurve [] crvarr = IG.curves();
      ISurface [] srfarr = IG.surfaces();
      IBrep [] breparr = IG.breps();
      IMesh [] mesharr = IG.meshes();
    
      for (IPoint pt : ptarr) {
        pt.del();
      }
    
      for (ICurve crv : crvarr) {
        crv.del();
      }
    
      for (ISurface srf : srfarr) {
        srf.del();
      }
    
      for (IBrep brep : breparr) {
        brep.del();
      }
    
      for (IMesh mesh : mesharr) {
        mesh.del();
      }
    }
    
Sign In or Register to comment.