[ADD] add a skeleton of the group and refactor some test datas.
This commit is contained in:
@@ -29,57 +29,19 @@
|
||||
|
||||
#include "raytracing.h"
|
||||
|
||||
#include "common_data.h"
|
||||
|
||||
using namespace Raytracer;
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
class CylinderTestIntersect
|
||||
{
|
||||
public:
|
||||
Tuple origin;
|
||||
Tuple direction;
|
||||
double t0 = -1;
|
||||
double t1 = -1;
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
class CylinderTestNormal
|
||||
{
|
||||
public:
|
||||
Tuple point;
|
||||
Tuple normal;
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
class CylinderTestConstrained
|
||||
{
|
||||
public:
|
||||
Tuple point;
|
||||
Tuple direction;
|
||||
uint16_t count;
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
class ConeTestConstrained
|
||||
{
|
||||
public:
|
||||
Tuple origin;
|
||||
Tuple direction;
|
||||
uint16_t count;
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
SCENARIO("A Ray misses a cylinder", "[features/cylinders.feature]")
|
||||
{
|
||||
// | origin | direction |
|
||||
// | point(1, 0, 0) | vector(0, 1, 0) |
|
||||
// | point(0, 0, 0) | vector(0, 1, 0) |
|
||||
// | point(0, 0, -5) | vector(1, 1, 1) |
|
||||
CylinderTestIntersect the_test[] = {
|
||||
DataOrigDirT0T1 the_test[] = {
|
||||
{Tuple::Point(1, 0, 0), Tuple::Vector(0, 1, 0)},
|
||||
{Tuple::Point(0, 0, 0), Tuple::Vector(0, 1, 0)},
|
||||
{Tuple::Point(0, 0, -5), Tuple::Vector(1, 1, 1)}
|
||||
@@ -114,7 +76,7 @@ SCENARIO("A Ray strikes a cylinder", "[features/cylinders.feature]")
|
||||
// | point(1, 0, -5) | vector(0, 0, 1) | 5 | 5 |
|
||||
// | point(0, 0, -5) | vector(0, 0, 1) | 4 | 6 |
|
||||
// | point(0.5, 0, -5) | vector(0.1, 1, 1) | 6.80798 | 7.08872 |
|
||||
CylinderTestIntersect the_test[] = {
|
||||
DataOrigDirT0T1 the_test[] = {
|
||||
{ Tuple::Point(1, 0, -5), Tuple::Vector(0, 0, 1), 5, 5},
|
||||
{ Tuple::Point(0, 0, -5), Tuple::Vector(0, 0, 1), 4, 6},
|
||||
{Tuple::Point(0.5, 0, -5), Tuple::Vector(0.1, 1, 1), 6.80798, 7.08872}
|
||||
@@ -161,7 +123,7 @@ SCENARIO("Normal vector on a cylinder", "[features/cylinders.feature]")
|
||||
// | point(0, 5, -1) | vector(0, 0, -1) |
|
||||
// | point(0, -2, 1) | vector(0, 0, 1) |
|
||||
// | point(-1, 1, 0) | vector(-1, 0, 0) |
|
||||
CylinderTestNormal the_test[] = {
|
||||
DataPointNormal the_test[] = {
|
||||
{ Tuple::Point(1, 0, 0), Tuple::Vector(1, 0, 0)},
|
||||
{ Tuple::Point(0, 5, -1), Tuple::Vector(0, 0, -1)},
|
||||
{ Tuple::Point(0, -2, 1), Tuple::Vector(0, 0, 1)},
|
||||
@@ -215,7 +177,7 @@ SCENARIO("Intersecting a constrained cylinder", "[features/cylinders.feature]")
|
||||
// | 4 | point(0, 2, -5) | vector(0, 0, 1) | 0 |
|
||||
// | 5 | point(0, 1, -5) | vector(0, 0, 1) | 0 |
|
||||
// | 6 | point(0, 1.5, -2) | vector(0, 0, 1) | 2 |
|
||||
CylinderTestConstrained the_test[] = {
|
||||
DataPointDirCount the_test[] = {
|
||||
{Tuple::Point(0, 1.5, 0), Tuple::Vector(0.1, 1, 0), 0},
|
||||
{Tuple::Point(0, 3, -5), Tuple::Vector(0, 0, 1), 0},
|
||||
{Tuple::Point(0, 0, -5), Tuple::Vector(0, 0, 1), 0},
|
||||
@@ -280,7 +242,7 @@ SCENARIO("Intersecting the caps of a closed cylinder", "[features/cylinders.feat
|
||||
// | 3 | point(0, 4, -2) | vector(0, -1, 1) | 2 | # corner case
|
||||
// | 4 | point(0, 0, -2) | vector(0, 1, 2) | 2 |
|
||||
// | 5 | point(0, -1, -2) | vector(0, 1, 1) | 2 | # corner case
|
||||
CylinderTestConstrained the_test[] = {
|
||||
DataPointDirCount the_test[] = {
|
||||
{Tuple::Point(0, 3, 0), Tuple::Vector(0, -1, 0), 2},
|
||||
{Tuple::Point(0, 3, -2), Tuple::Vector(0, -1, 2), 2},
|
||||
{Tuple::Point(0, 4, -2), Tuple::Vector(0, -1, 1), 2},
|
||||
@@ -335,7 +297,7 @@ SCENARIO("The normal vector on the cylinder's end caps", "[features/cylinders.fe
|
||||
// | point(0, 2, 0) | vector(0, 1, 0) |
|
||||
// | point(0.5, 2, 0) | vector(0, 1, 0) |
|
||||
// | point(0, 2, 0.5) | vector(0, 1, 0) |
|
||||
CylinderTestNormal the_test[] = {
|
||||
DataPointNormal the_test[] = {
|
||||
{ Tuple::Point(0, 1, 0), Tuple::Vector(0, -1, 0)},
|
||||
{Tuple::Point(0.5, 1, 0), Tuple::Vector(0, -1, 0)},
|
||||
{ Tuple::Point(0, 1, 0.5), Tuple::Vector(0, -1, 0)},
|
||||
@@ -381,7 +343,7 @@ SCENARIO("Intersecting a cone with a ray", "[features/cones.feature]")
|
||||
// | point(0, 0, -5) | vector(0, 0, 1) | 5 | 5 |
|
||||
// | point(0, 0, -5) | vector(1, 1, 1) | 8.66025 | 8.66025 |
|
||||
// | point(1, 1, -5) | vector(-0.5, -1, 1) | 4.55006 | 49.44994 |
|
||||
CylinderTestIntersect the_test[] = {
|
||||
DataOrigDirT0T1 the_test[] = {
|
||||
{Tuple::Point(0, 0, -5), Tuple::Vector(0, 0, 1), 5, 5},
|
||||
{Tuple::Point(0, 0, -5), Tuple::Vector(1, 1, 1), 8.66025, 8.66025},
|
||||
{Tuple::Point(1, 1, -5), Tuple::Vector(-0.5, -1, 1), 4.55006, 49.44994}
|
||||
@@ -458,7 +420,7 @@ SCENARIO("Intersecting a cone's end caps", "[features/cones.feature]")
|
||||
// | point(0, 0, -0.25) | vector(0, 1, 1) | 2 |
|
||||
// | point(0, 0, -0.25) | vector(0, 1, 0) | 4 |
|
||||
|
||||
ConeTestConstrained the_test[] = {
|
||||
DataOrigDirCount the_test[] = {
|
||||
{Tuple::Point(0, 0, -5), Tuple::Vector(0, 1, 0), 0},
|
||||
{Tuple::Point(0, 0, -0.25), Tuple::Vector(0, 1, 1), 2},
|
||||
{Tuple::Point(0, 0, -0.25), Tuple::Vector(0, 1, 0), 4}
|
||||
@@ -508,7 +470,7 @@ SCENARIO("Computing the normal vector on a cone", "[features/cones.feature]")
|
||||
// | point(0, 0, 0) | vector(0, 0, 0) |
|
||||
// | point(1, 1, 1) | vector(1, -sqrt(2), 1) |
|
||||
// | point(-1, -1, 0) | vector(-1, 1, 0) |
|
||||
CylinderTestNormal the_test[] = {
|
||||
DataPointNormal the_test[] = {
|
||||
{ Tuple::Point(0, 0, 0), Tuple::Vector(0, 0, 0)},
|
||||
{ Tuple::Point(1, 1, 1), Tuple::Vector(1, -sqrt(2), 1)},
|
||||
{Tuple::Point(-1, -1, 0), Tuple::Vector(-1, 1, 0)}
|
||||
|
||||
Reference in New Issue
Block a user