Skip to content

Instantly share code, notes, and snippets.

@arnholm arnholm/funcdef.md
Created Aug 22, 2019

Embed
What would you like to do?
// AngelCAD code, showing use of function pointer

funcdef double CALLBACK(int i);

solid@ object(CALLBACK@ f,int i) 
{ 
   return sphere(f(i)); 
}

// ====

double myfunc(int i) { return i*i; }

shape@ main_shape()
{
   return object(myfunc,5);
}

void main()
{
   shape@ obj = main_shape();
   obj.write_xcsg(GetInputFullPath(),secant_tolerance:-1.0);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.