Grasshopper

algorithmic modeling for Rhino

So I would like to run the following code within the solver portion of a custom c# component and not in a function.

However I cannot find a way to run this within the solver portion without it freezing like mad when run in GH.

 

The code needs to be in C# and compiled as /UNSAFE.

 

Any Ideas are much appreciated.

 

I know this is splitting hairs, but calling functions appears to be slower..... or am I missing something?

 

public unsafe float test(floatx)

{

float xhalf = 0.5f * x;

int i = *(int*)&x; // get bits for floating value

i = 0x5f375a86 - (i >> 1);

return x;

}

Views: 235

Replies to This Discussion

By the way this works fine, but calling a function is slower I am guessing?

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service