Grasshopper

algorithmic modeling for Rhino

Well friends,

Here's 3 test cases that I can't explain:

Case1 is a "straight" conversion from VB to C (red alert).

Case2 is also a "straight" conversion that "works"(?) but in a very faulty way.

Case3 is an exact "redo" from old to new C : grid points totally different.

Any advice/explanation could be much appreciated.

best, Peter

Views: 307

Attachments:

Replies to This Discussion

Hi Peter

I took the time to go one script after the other and I fixed all typo's, a couple of errors in the automatic code translation, and a missed conversion to doubles (rather than integers) that was causing issues.

It should all be working now. If not everything is perfect yet, just watch a little more for similar things :)
I hope this helps,

Giulio
--
Giulio Piacentino
for Robert McNeel & Associates
giulio@mcneel.com

Attachments:

Hi Giulio

I wonder...what was the most embarrassing? (maybe Case2 - I supposed that the double declaration means that the integer division (if on) should been overridden).

Thanks a lot

best, Peter

Nothing was embarrassing, at all. I do all these mistakes myself -- that's why I am a bit faster at spotting them now.

Giulio
--
Giulio Piacentino
for Robert McNeel & Associates
giulio@mcneel.com

Nothing you said? Well ... THAT'S embarrassing, he he:

That @$#$@ Surface.PointAt (Ux, Vx) - double, double again:

If I define iun,ivn (i,j,uNum,vNum are integers) as :

double iun = i / uNum;
double ivn = j/ vNum;

the results are like the Case2 (expected)

If I define them as (a "bit" ridiculous):

double iun = (i + 0.0) / (uNum + 0.0);
double ivn = (j + 0.0) / (vNum + 0.0);

the results are OK.

Thus the embarrassing question of the day: how to do it with a less ridiculous (int.ToDouble is not a method) way? And why double test = (Convert.ToDouble(i) / Convert.ToDouble(uNum)) doesn't work?

BTW: this works:

best, Peter

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service