We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
There is an optimization you can make for you Triangle type, though it sort of prevents using Triangle literals.
type Triangle struct { V1, V2, V3 Vector Box Box intersection func(Ray) HIt } func NewTriangle(....) Triangle { t.intersection = t.generateInsersectionFunction() return t } func (t *Triangle) generateInsersectionFunction() { // Precalculate things like determinants etc here, return the function with these pre-computed } func (t *Triangle) Intersection(r Ray) { if t.intersection == nil { t.generateIntersectionFunction()} return t.intersection(r) }
a useful optimization if you are doing a lots of intersections.
The text was updated successfully, but these errors were encountered:
The Compile function would be appropriate for this.
Compile
Care to submit a pull request? Would like to see performance numbers before/after.
Sorry, something went wrong.
No branches or pull requests
There is an optimization you can make for you Triangle type, though it sort of prevents using Triangle literals.
a useful optimization if you are doing a lots of intersections.
The text was updated successfully, but these errors were encountered: