nobodyinperson / sdf

Simple SDF mesh generation in Python

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add ray marching

nobodyinperson opened this issue · comments

goal is to find the distance the object takes up along a given axis. Either between two points or alone a given line (point + direction).

Two methods:

1D ray marching is easy as described above.

2D would be useful e.g. to find bounding box:

  • define function for distance to given plane (point+normal)
    • scipy optimize minimize of 2D coordinates on plane, cost function is direcly the SDF, params are 2D coordinates, resulting cost is minimum dostance
  • find root of that plane distance function alone given path

use cases:

  • find size of of object
  • find boundary of object to move it e.g. into positve z

Quick scipy.optimize.root tests:

  • method lm seems to do the intuitive thing, medium speed
  • method broyden2 and more so df.sane are very fast but sometimes find weird roots

Nested optimization works and is quite fast