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;
}
}
okay, so i'm trying to get these 3d jumble of lines into igeo and have them react to gravity, which i figured out, and also attract to each other like shown in this tutorial:
the problem is that in this tutorial each line is divided and the parts of the line are what attract, whereas in my current version it is more like this tutorial:
where each line is actually a segment of a larger polyline. now, i want the end points of each segment of the polyline to become the nodes that attract to each other like how it does in the first tutorial. however, the issue is that the first tutorial uses IBoids and the second uses IVec/IParticles.
I'm pretty new to igeo so i'm really confused as to how to translate this. please help!!
so i used toxiclibs to make a ball bounce around and a line trails after it by logging the ball's location every few steps and draws a line between every point in the list. now i can export those points for every list i have and put that into rhino/grasshopper to get the points and redraw the lines..
but igeo can just directly export a 3dm file from processing and that would take way less time and my computer crashes when i use grasshopper. so, is there any way to get the toxiclib points into igeo???? can they relate at all? i feel like it's pretty much the same information...please help!
so- i have this function i wrote in my code. the purpose of the code is to have an imported stl mesh in an enclosed environment, where these 'spiders' that i have will bounce around. i currently have it set so that there is a list of faces of the mesh, and then [cID] is the index number of the face. it's set by default to -9 so that it doesn't reference any face if none are within the collision distance [MIN_COL_DIST], which right now is set to 20 in a difference class.
okay. so what happens near the bottom of the code that is surrounded by //'s is that it finds the distance between the 'spider' and the nearest point on each of the edges on the faces, [cID]. if this distance is less than [mDist], then it refreshes mDist to be a new distance. as the distance between the 'spider' and the face's nearest edge point gets smaller and smaller, mDist continuously re-adjusts to the new, smaller distance, until it reaches the minimum collision distance to be considered a collision. which, as i said, right now, is 20. the velocity of the spider is currently 10. now i don't see why it wouldn't change directions and collide with the mesh. i have an inkling of what it might be, but i can't say for sure.
i think what the problem is though, is that i'm getting the closest point to the 'spider' from the EDGE of the face. and if the face has larger dimensions, like, say, larger than twice the minimum collision distance, (40), it won't register it as a collision. however i can't say for sure that this is the problem because it seems to just go through some of the faces and not through others and it's gone through near the edges before. so i'm just confused. what am i doing wrong!? is there a more accurate way to do this??
void checkWalls() { //checks for hits
List<Face> faces = new Vector<Face>();
int cID = -9; //-9 is a default, incase there is no hit