Skip to content

Instantly share code, notes, and snippets.

@arnholm
Created August 22, 2019 12:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arnholm/7061458777913e5795585eee46fcb664 to your computer and use it in GitHub Desktop.
Save arnholm/7061458777913e5795585eee46fcb664 to your computer and use it in GitHub Desktop.
// 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