Physically-Based Simulation For Optimization Guidance In Computer Graphics And Computer Vision