Skip to content

Suggestion for possible enhancements #1

@Anras573

Description

@Anras573

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

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions