Hemesh change parameters

hello! im using the hemesh library to construct 3D meshes, but ive a problem when i want to change the values of a constructor.. how can i change them? here in the example, i want to change the radius according mouseX position, but it doesnt do anything. i see hemeshve modifiers but i dont find any to change the radius or this parameters, like steps, or points.

import wblut.nurbs.*;
import wblut.hemesh.*;
import wblut.core.*;
import wblut.geom.*;
import wblut.processing.*;
import wblut.math.*;



WB_Render render;
WB_BSpline C;
WB_Point[] points;
HE_Mesh mesh;
HEC_SweepTube creator;

void setup() {
  size(1000,1000,P3D);
  smooth(8);
  // Several WB_Curve classes are in development. HEC_SweepTube provides
  // a way of generating meshes from them.

  //Generate a BSpline
  points=new WB_Point[11];
  for (int i=0;i<11;i++) {
    points[i]=new WB_Point(5*(i-5)*(i-5), -200+40*i, random(100));
  }
  C=new WB_BSpline(points, 4);

  creator=new HEC_SweepTube();
 
  creator.setCurve(C);//curve should be a WB_BSpline
  creator.setSteps(40);
  creator.setFacets(8);
  creator.setCap(true, true); // Cap start, cap end?
  mesh=new HE_Mesh(creator); 
  //HET_Diagnosis.validate(mesh);
  render=new WB_Render(this);
}

void draw() {
   creator.setRadius(mouseX);

  
  background(55);
  directionalLight(255, 255, 255, 1, 1, -1);
  directionalLight(127, 127, 127, -1, -1, 1);
  translate(width/2,height/2);
  rotateY(mouseX*1.0f/width*TWO_PI);
  rotateX(mouseY*1.0f/height*TWO_PI);
  stroke(0);
  render.drawEdges(mesh);
  noStroke();
  render.drawFaces(mesh);
}

You probably need to re-create mesh in draw, following works for me

import wblut.nurbs.*;
import wblut.hemesh.*;
import wblut.core.*;
import wblut.geom.*;
import wblut.processing.*;
import wblut.math.*;

WB_Render render;
WB_BSpline C;
WB_Point[] points;
HE_Mesh mesh;
HEC_SweepTube creator;

void setup() {
  size(1000, 1000, P3D);
  smooth(8);
  // Several WB_Curve classes are in development. HEC_SweepTube provides
  // a way of generating meshes from them.

  //Generate a BSpline
  points=new WB_Point[11];
  for (int i=0; i<11; i++) {
    points[i]=new WB_Point(5*(i-5)*(i-5), -200+40*i, random(100));
  }
  C=new WB_BSpline(points, 4);
  creator=new HEC_SweepTube();
  creator.setCurve(C);//curve should be a WB_BSpline
  creator.setSteps(40);
  creator.setFacets(8);
  creator.setCap(true, true); // Cap start, cap end?
}

void draw() {
  creator.setRadius(mouseX);
  mesh=new HE_Mesh(creator); 
  //HET_Diagnosis.validate(mesh);
  render=new WB_Render(this);
  background(55);
  directionalLight(255, 255, 255, 1, 1, -1);
  directionalLight(127, 127, 127, -1, -1, 1);
  translate(width/2, height/2);
  rotateY(mouseX*1.0f/width*TWO_PI);
  rotateX(mouseY*1.0f/height*TWO_PI);
  stroke(0);
  render.drawEdges(mesh);
  noStroke();
  render.drawFaces(mesh);
}

You could make it more efficient by not doing recalculation in every draw loop, there are various ways you could this, but basically mouseX as you correctly identify only makes sense in a draw loop, and I don’t see how you expected it to change the mesh already created in setup.

thanks Monkstone! witch are those ways? i dont need mouseX, just used for example. I need to change the values with a controlP5 / controller. and yes, doing this the performance down. Is there any other way?

but the performance problem is caused by recalculation in every draw loop ? what about if the problem is the create new mesh in every draw? im not want to create a new mesh, just change values.

I’ve not tried it myself but this might help HE_Mesh GUI update

I check that library. but it function with the he-mesh modifiers… and and dont found any to change this values…

i try this and it works… but now i`ve the problem that PShape factory havent a update(); or apply(); method like mesh. so, im in the same situation but trying to render into a PGraphics via PShape. anybody has a solution?

import wblut.nurbs.*;
import wblut.hemesh.*;
import wblut.core.*;
import wblut.geom.*;
import wblut.processing.*;
import wblut.math.*;
 
 
 PShape tube;
WB_Render render;
WB_BSpline C;
WB_Point[] points;
HE_Mesh mesh;
HEC_SweepTube creator;
 
void setup() {
  size(1000,1000,P3D);
  smooth(8);
  // Several WB_Curve classes are in development. HEC_SweepTube provides
  // a way of generating meshes from them.
 
  //Generate a BSpline
  points=new WB_Point[11];
     for (int i=0;i<11;i++) {
    points[i]=new WB_Point(5*(i-5)*(i-5), -200+40*i,random(100) );
  }
  C=new WB_BSpline(points, 4);
 
  creator=new HEC_SweepTube();
 
  creator.setCurve(C);//curve should be a WB_BSpline
  creator.setSteps(40);
  creator.setFacets(8);
  creator.setCap(true, true); // Cap start, cap end?
  mesh=new HE_Mesh(creator); 
  //
  render=new WB_Render(this);
      

}
 
void draw() {

     for (int i=0;i<11;i++) {
    points[i]=new WB_Point(cos(i*frameRate/20)*5*(i-5)*(i-5), -200+40*i, sin(i*frameRate/50)*200);
  }
   
    creator.setRadius(15);
    creator.apply(mesh);
    mesh.update();
    
    tube=WB_PShapeFactory.createSmoothPShape(mesh, this); // HERE IS THE PROBLEM. its create a PShape a lot of times and performance down. need some like "update"
    
  background(55);
  directionalLight(255, 255, 255, 1, 1, -1);
  directionalLight(127, 127, 127, -1, -1, 1);
  translate(width/2,height/2);
  rotateY(mouseX*1.0f/width*TWO_PI);
  rotateX(mouseY*1.0f/height*TWO_PI);
  stroke(0);
  shape(tube);
  //render.drawEdges(mesh);
  noStroke();
  //render.drawFaces(mesh);
}