Grasshopper

algorithmic modeling for Rhino

Hi,

When creating custom kangaroo goals, while extending IGoal class, what does this function do ?

public IGoal Clone()
{
return this.MemberwiseClone() as IGoal;
}

Thanks,

Petras

Views: 697

Attachments:

Replies to This Discussion

Hi Petras,

I recommend extending the GoalObject class instead of IGoal directly. GoalObject is an abstract class which implements IGoal for you, and handles some of the default methods. It also allows me a bit of flexibility.

I might change IGoal at some point in the future (such as adding some new method to it), which would break code implementing that interface directly, but I could update GoalObject to include that new method, and older code implementing GoalObject would all still work.

Here is an example of a class implementing GoalObject:

https://github.com/Dan-Piker/K2Goals/blob/master/SoapFilm.cs

The only reason some of the other Goals on that repo implement IGoal is because they were written before GoalObject existed. At some point I intend to go through and replace all these with the cleaner GoalObject implementation.

The Clone() method is currently not used in any of the released components, so don't worry about implementing it. It is there for some experiments I was doing combining remeshing and K2 goals, which I can explain more once I release them.

Thank you for explanation.

So it is the same GoalObject as explained during the workshop:) Thanks

Would it be possible to share how SolidPointCollide goal was made?

As I am constantly working with it.

First I thought that it is connected with closest point function. But none of collision examples are open source.

If it is not open source, could you roughly describe how it works?

P.S. Thank you for sharing .cs files of goal objects. It helps a lot to understand the library.

Attachments:

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