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

Open
Anras573 opened this issue Jun 3, 2019 · 2 comments
Open

Suggestion for possible enhancements #1

Anras573 opened this issue Jun 3, 2019 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@Anras573
Copy link

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);  
}

usage:

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

system.mathf

@simonech
Copy link
Owner

simonech commented Jun 3, 2019 via email

@Anras573
Copy link
Author

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 modified the milestones: Rework, After Chapter 2 Jun 5, 2019
@simonech simonech added the enhancement New feature or request label 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
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants