Static/Active Igeo.
in
Contributed Library Questions
•
10 months ago
it says i'm mixing active and static modes. this has worked for me before in different codes, so i'm not sure why it can't work this time. in fact, it won't let me save the geometry to a 3dm no matter what i do. please help.
import processing.opengl.*;
import igeo.*;
size(480, 360, IG.GL);
//IG.bg(0);
IG.open("bridgeattractor.3dm");
ICurve[] curves = IG.curves();
new IAttractor(1775.892454, 342.613484, 206.394909).intensity(-50).linear(30).clr(1.0,0,0).size(8);
new IAttractor(1561.232073, -740.638826, 206.394909).intensity(-30).linear(10).clr(1.0,0,0).size(8);
new IAttractor(979.163842, -1040.366489, 206.394909).intensity(-50).linear(30).clr(1.0,0,0).size(8);
new IAttractor(-446.331538, -227.397068, 206.394909).intensity(-1000).linear(200).clr(0,0,0).size(200);
new IAttractor(-1326.528052, -1164.888441, 206.394909).intensity(-50).linear(30).clr(1.0,0,0).size(8);
new IAttractor(-1505.273869, -555.293731, 206.394909).intensity(-30).linear(10).clr(1.0,0,0).size(8);
new IAttractor(-1413.800407, 332.942895, 206.394909).intensity(-50).linear(30).clr(1.0,0,0).size(8);
new IAttractor(898.164832, 558.873218, 200.213306).intensity(-30).linear(10).clr(1.0,0,0).size(8);
int division=50;
double inc = 1.0/division;
for (int i=0; i < curves.length; i++) {
IBoid[] pts = new IBoid[division+1];
for (int j=0; j <= division; j++) { // creating particles
pts[j] = new IBoid( curves[i].pt( j*inc ) ).fric(0.1);
pts[j].cohesionDist(50);
pts[j].cohesionRatio(50);
pts[j].separationRatio(80);
pts[j].alignmentRatio(20);
// pts[j].hide();
}
pts[0].fix(); // fixing the start point
pts[division].fix(); // fixing the end point
for (int j=0; j < division; j++) { // connecting particles
new ITensionLine(pts[j], pts[j+1]).tension(50).clr(1.0, 0.5).weight(2);
// record.add(pts[j], pts[j+1]);
}
curves[i].del();
println("done");
}
public void KeyPressed(){
switch (key){
case 's':
IG.save("attractorbridge.3dm");
println("done");
break;
}
}
import processing.opengl.*;
import igeo.*;
size(480, 360, IG.GL);
//IG.bg(0);
IG.open("bridgeattractor.3dm");
ICurve[] curves = IG.curves();
new IAttractor(1775.892454, 342.613484, 206.394909).intensity(-50).linear(30).clr(1.0,0,0).size(8);
new IAttractor(1561.232073, -740.638826, 206.394909).intensity(-30).linear(10).clr(1.0,0,0).size(8);
new IAttractor(979.163842, -1040.366489, 206.394909).intensity(-50).linear(30).clr(1.0,0,0).size(8);
new IAttractor(-446.331538, -227.397068, 206.394909).intensity(-1000).linear(200).clr(0,0,0).size(200);
new IAttractor(-1326.528052, -1164.888441, 206.394909).intensity(-50).linear(30).clr(1.0,0,0).size(8);
new IAttractor(-1505.273869, -555.293731, 206.394909).intensity(-30).linear(10).clr(1.0,0,0).size(8);
new IAttractor(-1413.800407, 332.942895, 206.394909).intensity(-50).linear(30).clr(1.0,0,0).size(8);
new IAttractor(898.164832, 558.873218, 200.213306).intensity(-30).linear(10).clr(1.0,0,0).size(8);
int division=50;
double inc = 1.0/division;
for (int i=0; i < curves.length; i++) {
IBoid[] pts = new IBoid[division+1];
for (int j=0; j <= division; j++) { // creating particles
pts[j] = new IBoid( curves[i].pt( j*inc ) ).fric(0.1);
pts[j].cohesionDist(50);
pts[j].cohesionRatio(50);
pts[j].separationRatio(80);
pts[j].alignmentRatio(20);
// pts[j].hide();
}
pts[0].fix(); // fixing the start point
pts[division].fix(); // fixing the end point
for (int j=0; j < division; j++) { // connecting particles
new ITensionLine(pts[j], pts[j+1]).tension(50).clr(1.0, 0.5).weight(2);
// record.add(pts[j], pts[j+1]);
}
curves[i].del();
println("done");
}
public void KeyPressed(){
switch (key){
case 's':
IG.save("attractorbridge.3dm");
println("done");
break;
}
}
1