As you can see in the picture the control points in the lower left box created via Bounding Box does not follow the same pattern as the rest of the boxes. Yes, the order is the same (counterclockwise), but the starting point is not.
During my course at the university we ran into a similar situation and though we tried to fix it but were unable to. Is there a logical explanation for this or is it just a software issue?
Hah! Software issues usually have logical explanations. You didnāt internalize your curves but a wild guess would be that one of the curves is flipped, going the opposite direction from the others?
You can use Flip Curve with a guide curve (a circle will do) to make them all the same.
OK, I really must read these things more carefully. Flipping curves only affects their direction, not their starting point. I would have applied Flip Curve at the very beginning instead of later, as you did, after BBox. CAUTION:Control Points gives you five points by duplicating the start/end point whereas Discontinuity gives you four points, no duplicates.
Looking very carefully now, I see one plane from your C# component that has its X direction wrong:
I appreciate the effort Joseph. Also thanks for explaining the difference between Discontinuity and Control Points.
Well in the end if I do not manage I thought I could just run the whole definition in the blocks that are working funky. Is not an elegant solution but works for the time being.
Thanks for the solution @Adam_M . This is actually a Script that was given to us by my university as part of our classes. Since a lot of things are still in development they might have some issues but this just solved, at least my problem.
Changing the for loop in line #6 to start at 0 instead of 1 fixes the problem: for (int j = 0; j < 361 ; j++){
Since you are dividing the j value by 4 in line #8 and line #19 the code is actually looping from 0 to 90 degrees in 0.25 degree steps. The intent of the code could be made more clearly understandable by changing line #6 to: for (double j = 0; j < 90 ; j+=0.25){
This will loop from 0 to 89.75 degrees in 0.25 degree steps. To accommodate this change, you need to remove the divisions by 4 from lines #8 & #19. (There is no need to check the area at 90 degrees as it is exactly the same as the area at 0 degrees.)
There is also no need to create Point3D objects in lines #10 & #11. The BoundingBox object provides a Diagonal property provides these values in a vector.
Iām suprised how much faster this C# script is compared to doing this with native grasshopper components.
I did some comparisons using the Anemone loop from the script linked in the post above from @Joseph_Oster. Just comparing the time from the Fast Loop End component to the C# Script component the script is ~23.5 times faster when doing 360 loops (0 to 89.75 degrees, 0.25 degree steps). I may look into this further when I have time.
My Profiler says the C# loop is four times faster than the Anemone loop (both doing 360 iterations).
C# is 2.5 secs. vs. Anemone at 9.9 secs.
The C# could be changed to this: (-45 to 45 degrees)
for (double j = -45; j < 45; j += 0.25){
Also, I wonder if the C# could be faster if all the rotated planes are created just once, outside the āforā loops, as I did in the orange group? That code is executed only once. They would be accessed by index.
When I was running this script earlier today Iām certain that the Anemone Loop was reporting ~57.5 seconds, I ran it several times to compare results.
Now when I run it, the C# script is reporting 2.2 seconds and the Anemone Loop is reporting 17.7 seconds. I did close and re-start Rhino since I was looking at this before but the script hasnāt changed.
Iāve never done any C# coding before so I was trying to be careful as I was working through this. I do have a little experience with plain C and C++ but havenāt used it much in the past 20 years.
Hi all!
A small fix that we can do is to let curve enters the c# script.
There was like 400ms wasted to convert the curves to brep because of the input type hint.
Done thatā¦ but I wasnāt able to measure the difference in execution.
Currently the c# does the job in 20ms on my pcā¦
Maybe the BBox calculation is much heavier if done on surfaces/brep objects.