algorithmic modeling for Rhino
Hi all,
I'm trying to make an approximation of the Gilbert Tesselation (https://en.wikipedia.org/wiki/Gilbert_tessellation) for a project I'm currently working on, and I'm having a little trouble with the method by which curve intersections are sorted in Grasshopper.
I'm using a couple of random seed generators to create the direction and growth rate of the rays using a timer component but I'm getting stuck with how to truncate the lines when an intersection occurs. It seems to work initially but as the seed lines extend the resulting lines jump around a lot.
I imaging this is happening because each step retains the list structure so if there is an intersection with the an item earlier in the list it will default to that.
Can anyone give me any tips at all?
Tags:
Have you tried the [Substrate] component? It sounds like it's pretty close to what you want already. It is based roughly on this applet.
Hi,
The top image looks correct, but Rhino Crashes whenever I try to open your .gh file. I am using 0.9.0076 in Rhino 5.0.
Still for Rhino WiP and GH 1.0
Here is the source in C# quite easy to put in V5,
One input list of lines
2 outputs
*********************************************
private void RunScript(List<Line> lines, ref object A, ref object B)
{
//Laurent Delrieu 12/10/2017
//Parameter of the intersection on first curve
double a;
//Parameter of the intersection on second curve
double b;
double param_max;
List<Line> output = new List<Line>();
for (int ia = 0; ia < lines.Count; ia++)
{
//Max length for unitized lines
param_max = 200.0;
for (int ib = 0; ib < lines.Count; ib++)
{
//To not have intersection on same lines
if (ib != ia)
{
//I treat as infinite line => false, lines must be parametrized
bool rc = Rhino.Geometry.Intersect.Intersection.LineLine(lines[ia], lines[ib], out a, out b, 0.0001, false);
if (rc)
{
if ((a > 0) && (b > 0))
{
if (a > b)
{
if (a < param_max)
{
param_max = a;
}
}
}
}
}
}
output.Add(new Line(lines[ia].PointAt(0.0), lines[ia].PointAt(param_max)));
}
//Try to heel place where lines are too short
//Not bullet proof !!!
List<Line> output2 = new List<Line>();
for (int ia = 0; ia < output.Count; ia++)
{
param_max = 200.0;
for (int ib = 0; ib < output.Count; ib++)
{
if (ib != ia)
{
//I treat as infinite line => false, lines must be parametrized
bool rc = Rhino.Geometry.Intersect.Intersection.LineLine(output[ia], output[ib], out a, out b, 0.0001, false);
if (rc)
{
//Intersection must be on ib
if ((b >= 0) && (b <= 1))
{
if ((Math.Abs(a - 1.0) < 1e-6))
{
param_max = 1.0;
break;
}
else
{
if ((a < param_max) && ( a > 1))
{
param_max = a;
}
}
}
}
}
}
output2.Add(new Line(output[ia].PointAt(0.0), output[ia].PointAt(param_max)));
}
//Not cured Gilbert tesseletation
A = output;
//Cured Gilbert tesseletation
B = output2;
}*****************************************************
Hey,
Very interesting and beautiful work man.
I kept working on your grasshopper definition. I am not sure if it generates the result you want now but if I understand the concept right, it shoukd be it.
Also I have the same problem of not being able to run the C# script. Looks beautiful but rhino crashes, and when I tried to make the component with the lines, still did not work. If possible that you put here a grasshopper file with only that component might be helpful..
Thanks man.. keep up the good work
Hello,
I don't understand what you want to do but there are many errors.
My script want a list of lines. So if you provide a tree each branch will be a taken separately.
Your lines have 0 length. Not Good.
The logic of my script is that a line is a fracture that will begin a the beginning and going in the direction of the end. SO if you provides at each point 2 lines with the same beginning you will have a crack with a kink. If lines are parallel and going in opposite direction that will become a classical Gilbert Tesselation.
There are still "bugs", there is not all the cracks.
Hope it is clear.
It is clear, thanks for posting your c# definition
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by