Skip to content
New issue

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

Suggestion for possible enhancements #1

Anras573 opened this issue Jun 3, 2019 · 2 comments

Suggestion for possible enhancements #1

Anras573 opened this issue Jun 3, 2019 · 2 comments


Copy link

@Anras573 Anras573 commented Jun 3, 2019

Hi @simonech

Good to see someone else doing the ray tracer challenge with .NET CORE!

I have some suggestions if you don't mind :)

  1. Instead of creating a method called add, you can define an operator called + (same for -, /, *) like this:
public static Tupple operator +(Tupple left, Tupple right)  
    return new Tupple(left.X + right.X, left.Y + right.Y, left.Z + right.Z, left.W + right.W);  


var t1 = new Tupple(1.0f, 1.0f, 1.0f, 1.0f);
var t2 = new Tupple(2.0f, 2.0f, 2.0f, 2.0f);
var sum = t1 + t2;
  1. I am not sure which version of .NET CORE you're using, but since 2.1 preview it has included a math library for float values


Copy link

@simonech simonech commented Jun 3, 2019

Copy link

@Anras573 Anras573 commented Jun 4, 2019

Btw, tuple is with one P :)

Now I have to do a search-and-replace throughout my code!

Glad I could help :)

@simonech simonech added this to the Rework milestone Jun 5, 2019
@simonech simonech removed this from the Rework milestone Jun 5, 2019
@simonech simonech added this to the After Chapter 2 milestone Jun 5, 2019
@simonech simonech self-assigned this Jun 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants