├── .gitignore ├── Code ├── Include │ ├── blobtree.h │ ├── evector.h │ ├── fundamentals.h │ └── mathematics.h └── Source │ ├── blobtree.cpp │ ├── evector.cpp │ ├── fundamentals.cpp │ ├── main.cpp │ └── mathematics.cpp ├── G++ ├── Makefile ├── SegmentTracing.make └── premake4.lua ├── LICENSE ├── README.md ├── Renders ├── render0.ppm ├── render0_cost.ppm ├── render1.ppm ├── render1_cost.ppm ├── render2.ppm └── render2_cost.ppm ├── Scenes └── particles.txt ├── VS2017 ├── SegmentTracing-EG2020.vcxproj ├── SegmentTracing-EG2020.vcxproj.filters ├── SegmentTracing-EG2020.vcxproj.user └── SegmentTracing.sln ├── VS2019 ├── SegmentTracing-EG2020.vcxproj ├── SegmentTracing-EG2020.vcxproj.filters ├── SegmentTracing-EG2020.vcxproj.user └── SegmentTracing.sln ├── VS2022 ├── SegmentTracing-EG2020.vcxproj ├── SegmentTracing-EG2020.vcxproj.filters ├── SegmentTracing-EG2020.vcxproj.user ├── SegmentTracing.sln ├── render0.ppm ├── render0_cost.ppm ├── render1.ppm ├── render1_cost.ppm ├── render2.ppm └── render2_cost.ppm └── representative.png /.gitignore: -------------------------------------------------------------------------------- 1 | # Visual Studio specific 2 | .vs/ 3 | Out/ 4 | Temp/ 5 | 6 | # Prerequisites 7 | *.d 8 | 9 | # Compiled Object files 10 | *.slo 11 | *.lo 12 | *.o 13 | *.obj 14 | 15 | # Precompiled Headers 16 | *.gch 17 | *.pch 18 | 19 | # Compiled Dynamic libraries 20 | *.so 21 | *.dylib 22 | *.dll 23 | 24 | # Fortran module files 25 | *.mod 26 | *.smod 27 | 28 | # Compiled Static libraries 29 | *.lai 30 | *.la 31 | *.a 32 | *.lib 33 | 34 | # Executables 35 | *.exe 36 | *.out 37 | *.app 38 | -------------------------------------------------------------------------------- /Code/Include/blobtree.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "fundamentals.h" 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | class BlobTreeNode 12 | { 13 | protected: 14 | Box box; //!< Bounding box 15 | double k; //!< Lipschitz constant 16 | 17 | public: 18 | BlobTreeNode(const Box& b); 19 | 20 | virtual double Intensity(const Vector& p) const = 0; 21 | virtual Vector Gradient(const Vector& p) const; 22 | 23 | virtual inline double K() const 24 | { 25 | return k; 26 | } 27 | 28 | virtual inline double K(const Segment&) const 29 | { 30 | return k; 31 | } 32 | 33 | inline Box GetBox() const 34 | { 35 | return box; 36 | } 37 | 38 | inline double CubicFalloff(double x, double r) const 39 | { 40 | return (x > r) ? 0.0 : (1.0 - x / r) * (1.0 - x / r) * (1.0 - x / r); 41 | } 42 | 43 | inline double CubicFalloffK(double e, double R) const 44 | { 45 | return 1.72 * abs(e) / R; 46 | } 47 | 48 | inline double CubicFalloffK(double a, double b, double R, double s) const 49 | { 50 | if (a > R * R) 51 | return 0.0; 52 | if (b < (R * R) / 5.0) 53 | { 54 | double t = (1.0 - b / (R * R)); 55 | return abs(s) * 6.0 * (sqrt(b) / (R * R)) * (t * t); 56 | } 57 | else if (a > (R * R) / 5.0) 58 | { 59 | double t = (1.0 - a / (R * R)); 60 | return abs(s) * 6.0 * (sqrt(a) / (R * R)) * (t * t); 61 | } 62 | else 63 | return CubicFalloffK(s, R); 64 | } 65 | }; 66 | 67 | class BlobTreeBlend : public BlobTreeNode 68 | { 69 | protected: 70 | BlobTreeNode* e[2]; //!< Child nodes. 71 | 72 | public: 73 | BlobTreeBlend(BlobTreeNode* e1, BlobTreeNode* e2); 74 | 75 | double Intensity(const Vector& p) const; 76 | Vector Gradient(const Vector& p) const; 77 | double K() const; 78 | double K(const Segment& s) const; 79 | }; 80 | 81 | class BlobTreePoint : public BlobTreeNode 82 | { 83 | private: 84 | Vector c; //!< Center 85 | double r; //!< Radius 86 | double e; //!< Energy 87 | 88 | public: 89 | BlobTreePoint(const Vector& pp, double rr, double ee); 90 | 91 | double Intensity(const Vector& p) const; 92 | double K(const Segment& s) const; 93 | 94 | static BlobTreeNode* BVHRecursive(std::vector& pts, int begin, int end); 95 | static BlobTreeNode* OptimizeHierarchy(std::vector& pts, int begin, int end); 96 | static BlobTreeNode* OptimizeHierarchy(const std::vector& c, double r); 97 | }; 98 | 99 | class BlobTree 100 | { 101 | private: 102 | BlobTreeNode* root; 103 | 104 | public: 105 | BlobTree(); 106 | BlobTree(BlobTreeNode* rr); 107 | BlobTree(const char* path); 108 | 109 | double Intensity(const Vector& p); 110 | Vector Gradient(const Vector& p) const; 111 | double K() const; 112 | double K(const Segment& s) const; 113 | 114 | Box GetBox() const; 115 | }; 116 | -------------------------------------------------------------------------------- /Code/Include/evector.h: -------------------------------------------------------------------------------- 1 | #ifdef min 2 | #undef min 3 | #endif 4 | 5 | #ifdef max 6 | #undef max 7 | #endif 8 | 9 | #ifndef __Vector__ 10 | #define __Vector__ 11 | 12 | // Mathematics fundamentals 13 | #include "mathematics.h" 14 | 15 | // Class 16 | class Vector 17 | { 18 | protected: 19 | double c[3]; //!< Components. 20 | public: 21 | //! Empty 22 | inline Vector() { c[0] = c[1] = c[2] = 0.0; } 23 | 24 | explicit Vector(const double&); 25 | explicit Vector(const double&, const double&, const double&); 26 | 27 | // Access members 28 | double& operator[] (int); 29 | double operator[] (int) const; 30 | 31 | // Unary operators 32 | Vector operator+ () const; 33 | Vector operator- () const; 34 | 35 | // Assignment operators 36 | Vector& operator+= (const Vector&); 37 | Vector& operator-= (const Vector&); 38 | Vector& operator*= (const Vector&); 39 | Vector& operator/= (const Vector&); 40 | Vector& operator*= (const double&); 41 | Vector& operator/= (const double&); 42 | 43 | // Binary operators 44 | friend int operator> (const Vector&, const Vector&); 45 | friend int operator< (const Vector&, const Vector&); 46 | 47 | friend int operator>= (const Vector&, const Vector&); 48 | friend int operator<= (const Vector&, const Vector&); 49 | 50 | // Binary operators 51 | friend Vector operator+ (const Vector&, const Vector&); 52 | friend Vector operator- (const Vector&, const Vector&); 53 | 54 | friend double operator* (const Vector&, const Vector&); 55 | 56 | friend Vector operator* (const Vector&, double); 57 | friend Vector operator* (const double&, const Vector&); 58 | friend Vector operator/ (const Vector&, double); 59 | 60 | friend Vector operator/ (const Vector&, const Vector&); 61 | 62 | // Boolean functions 63 | friend int operator==(const Vector&, const Vector&); 64 | friend int operator!=(const Vector&, const Vector&); 65 | 66 | // Norm 67 | friend double Norm(const Vector&); 68 | friend double SquaredNorm(const Vector&); 69 | 70 | int MaxIndex() const; 71 | 72 | friend void Normalize(Vector&); 73 | friend Vector Normalized(const Vector&); 74 | 75 | // Compare functions 76 | static Vector Min(const Vector&, const Vector&); 77 | static Vector Max(const Vector&, const Vector&); 78 | 79 | // Abs 80 | friend Vector Abs(const Vector&); 81 | 82 | // Orthogonal and orthonormal vectors 83 | Vector Orthogonal() const; 84 | void Orthonormal(Vector&, Vector&) const; 85 | 86 | friend void Swap(Vector&, Vector&); 87 | friend Vector Clamp(const Vector&, const Vector&, const Vector&); 88 | friend Vector Lerp(const Vector&, const Vector&, const double&); 89 | 90 | // Scale 91 | Vector Scale(const Vector&) const; 92 | Vector Inverse() const; 93 | 94 | static Vector Solve(const Vector&, const Vector&, const double&, const double&); 95 | 96 | public: 97 | static const Vector Null; //!< Null vector. 98 | }; 99 | 100 | /*! 101 | \brief Create a vector with the same coordinates. 102 | \param a Real. 103 | */ 104 | inline Vector::Vector(const double& a) 105 | { 106 | c[0] = c[1] = c[2] = a; 107 | } 108 | 109 | /*! 110 | \brief Create a vector with argument coordinates. 111 | \param a,b,c Coordinates. 112 | */ 113 | inline Vector::Vector(const double& a, const double& b, const double& c) 114 | { 115 | Vector::c[0] = a; 116 | Vector::c[1] = b; 117 | Vector::c[2] = c; 118 | } 119 | 120 | //! Gets the i-th coordinate of vector. 121 | inline double& Vector::operator[] (int i) 122 | { 123 | return c[i]; 124 | } 125 | 126 | //! Returns the i-th coordinate of vector. 127 | inline double Vector::operator[] (int i) const 128 | { 129 | return c[i]; 130 | } 131 | 132 | // Unary operators 133 | 134 | //! Overloaded. 135 | inline Vector Vector::operator+ () const 136 | { 137 | return *this; 138 | } 139 | 140 | //! Overloaded. 141 | inline Vector Vector::operator- () const 142 | { 143 | return Vector(-c[0], -c[1], -c[2]); 144 | } 145 | 146 | // Assignment unary operators 147 | 148 | //! Destructive addition. 149 | inline Vector& Vector::operator+= (const Vector& u) 150 | { 151 | c[0] += u.c[0]; c[1] += u.c[1]; c[2] += u.c[2]; 152 | return *this; 153 | } 154 | 155 | //! Destructive subtraction. 156 | inline Vector& Vector::operator-= (const Vector& u) 157 | { 158 | c[0] -= u.c[0]; c[1] -= u.c[1]; c[2] -= u.c[2]; 159 | return *this; 160 | } 161 | 162 | //! Destructive scalar multiply. 163 | inline Vector& Vector::operator*= (const double& a) 164 | { 165 | c[0] *= a; c[1] *= a; c[2] *= a; 166 | return *this; 167 | } 168 | 169 | /*! 170 | \brief Scale a vector. 171 | \param a Scaling vector. 172 | */ 173 | inline Vector Vector::Scale(const Vector& a) const 174 | { 175 | return Vector(c[0] * a[0], c[1] * a[1], c[2] * a[2]); 176 | } 177 | 178 | /*! 179 | \brief Inverse of a vector. 180 | 181 | This function inverses the components of the vector. This is the same as: 182 | \code 183 | Vector v=Vector(1.0/u[0],1.0/u[1],1.0/u[2]); 184 | \endcode 185 | */ 186 | inline Vector Vector::Inverse() const 187 | { 188 | return Vector(1.0 / c[0], 1.0 / c[1], 1.0 / c[2]); 189 | } 190 | 191 | //! Destructive division by a scalar. 192 | inline Vector& Vector::operator/= (const double& a) 193 | { 194 | c[0] /= a; c[1] /= a; c[2] /= a; 195 | return *this; 196 | } 197 | 198 | /*! 199 | \brief Destructively scale a vector by another vector. 200 | 201 | This is the same as Scale: 202 | \code 203 | Vector u(2.0,-1.0,1.0); 204 | u.Scale(Vector(3.0,1.0,2.0)); // u*=Vector(3.0,1.0,2.0); 205 | \endcode 206 | */ 207 | inline Vector& Vector::operator*= (const Vector& u) 208 | { 209 | c[0] *= u.c[0]; c[1] *= u.c[1]; c[2] *= u.c[2]; 210 | return *this; 211 | } 212 | 213 | //! Destructively divide the components of a vector by another vector. 214 | inline Vector& Vector::operator/= (const Vector& u) 215 | { 216 | c[0] /= u.c[0]; c[1] /= u.c[1]; c[2] /= u.c[2]; 217 | return *this; 218 | } 219 | 220 | //! Compare two vectors. 221 | inline int operator> (const Vector& u, const Vector& v) 222 | { 223 | return ((u.c[0] > v.c[0]) && (u.c[1] > v.c[1]) && (u.c[2] > v.c[2])); 224 | } 225 | 226 | //! Compare two vectors. 227 | inline int operator< (const Vector& u, const Vector& v) 228 | { 229 | return ((u.c[0] < v.c[0]) && (u.c[1] < v.c[1]) && (u.c[2] < v.c[2])); 230 | } 231 | 232 | //! Overloaded 233 | inline int operator>= (const Vector& u, const Vector& v) 234 | { 235 | return ((u.c[0] >= v.c[0]) && (u.c[1] >= v.c[1]) && (u.c[2] >= v.c[2])); 236 | } 237 | 238 | //! Overloaded 239 | inline int operator<= (const Vector& u, const Vector& v) 240 | { 241 | return ((u.c[0] <= v.c[0]) && (u.c[1] <= v.c[1]) && (u.c[2] <= v.c[2])); 242 | } 243 | 244 | //! Adds up two vectors. 245 | inline Vector operator+ (const Vector& u, const Vector& v) 246 | { 247 | return Vector(u.c[0] + v.c[0], u.c[1] + v.c[1], u.c[2] + v.c[2]); 248 | } 249 | 250 | //! Difference between two vectors. 251 | inline Vector operator- (const Vector& u, const Vector& v) 252 | { 253 | return Vector(u.c[0] - v.c[0], u.c[1] - v.c[1], u.c[2] - v.c[2]); 254 | } 255 | 256 | //! Scalar product. 257 | inline double operator* (const Vector& u, const Vector& v) 258 | { 259 | return (u.c[0] * v.c[0] + u.c[1] * v.c[1] + u.c[2] * v.c[2]); 260 | } 261 | 262 | //! Right multiply by a scalar. 263 | inline Vector operator* (const Vector& u, double a) 264 | { 265 | return Vector(u.c[0] * a, u.c[1] * a, u.c[2] * a); 266 | } 267 | 268 | //! Left multiply by a scalar. 269 | inline Vector operator* (const double& a, const Vector& v) 270 | { 271 | return v * a; 272 | } 273 | 274 | //! Cross product. 275 | inline Vector operator/ (const Vector& u, const Vector& v) 276 | { 277 | return Vector(u.c[1] * v.c[2] - u.c[2] * v.c[1], u.c[2] * v.c[0] - u.c[0] * v.c[2], u.c[0] * v.c[1] - u.c[1] * v.c[0]); 278 | } 279 | 280 | //! Left multiply by a scalar 281 | inline Vector operator/ (const Vector& u, double a) 282 | { 283 | return Vector(u.c[0] / a, u.c[1] / a, u.c[2] / a); 284 | } 285 | 286 | // Boolean functions 287 | 288 | //! Strong equality test. 289 | inline int operator== (const Vector& u, const Vector& v) 290 | { 291 | return ((u.c[0] == v.c[0]) && (u.c[1] == v.c[1]) && (u.c[2] == v.c[2])); 292 | } 293 | 294 | //! Strong difference test. 295 | inline int operator!= (const Vector& u, const Vector& v) 296 | { 297 | return (!(u == v)); 298 | } 299 | 300 | /*! 301 | \brief Compute the Euclidean norm of a vector. 302 | 303 | This function involves a square root computation, it is in general more efficient to rely on 304 | the squared norm of a vector instead. 305 | \param u %Vector. 306 | \sa SquaredNorm 307 | */ 308 | inline double Norm(const Vector& u) 309 | { 310 | return sqrt(u.c[0] * u.c[0] + u.c[1] * u.c[1] + u.c[2] * u.c[2]); 311 | } 312 | 313 | /*! 314 | \brief Compute the squared Euclidean norm of a vector. 315 | \param u %Vector. 316 | \sa Norm 317 | */ 318 | inline double SquaredNorm(const Vector& u) 319 | { 320 | return (u.c[0] * u.c[0] + u.c[1] * u.c[1] + u.c[2] * u.c[2]); 321 | } 322 | 323 | /*! 324 | \brief Return a normalized vector. 325 | 326 | Compute the inverse of its norm and scale the components. 327 | 328 | This function does not check if the vector is null. 329 | \param u %Vector. 330 | */ 331 | inline Vector Normalized(const Vector& u) 332 | { 333 | return u * (1.0 / Norm(u)); 334 | } 335 | 336 | /*! 337 | \brief Compute the index of the maximum component of a vector. 338 | 339 | 340 | \code 341 | Vector a(-1.0,-3.0,2.0); 342 | int i=MaxIndex(Abs(a)); // Should be 1 343 | \endcode 344 | 345 | This function can be used to find the most stretched axis of a bounding box, 346 | for instance to cut the box in the middle of this stretched axis: 347 | 348 | \code 349 | Box box; 350 | int axis = box.Diagonal().MaxIndex(); 351 | \endcode 352 | 353 | \sa Max 354 | */ 355 | inline int Vector::MaxIndex() const 356 | { 357 | if (c[0] >= c[1]) 358 | { 359 | if (c[0] >= c[2]) 360 | { 361 | return 0; 362 | } 363 | else 364 | { 365 | return 2; 366 | } 367 | } 368 | else 369 | { 370 | if (c[1] >= c[2]) 371 | { 372 | return 1; 373 | } 374 | else 375 | { 376 | return 2; 377 | } 378 | } 379 | } 380 | 381 | /*! 382 | \brief Computes the absolute value of a vector. 383 | \param u %Vector. 384 | */ 385 | inline Vector Abs(const Vector& u) 386 | { 387 | return Vector(u[0] > 0.0 ? u[0] : -u[0], u[1] > 0.0 ? u[1] : -u[1], u[2] > 0.0 ? u[2] : -u[2]); 388 | } 389 | 390 | /*! 391 | \brief Return a vector with coordinates set to the minimum coordinates 392 | of the two argument vectors. 393 | */ 394 | inline Vector Vector::Min(const Vector& a, const Vector& b) 395 | { 396 | return Vector(a[0] < b[0] ? a[0] : b[0], a[1] < b[1] ? a[1] : b[1], a[2] < b[2] ? a[2] : b[2]); 397 | } 398 | 399 | /*! 400 | \brief Return a vector with coordinates set to the maximum coordinates 401 | of the two argument vectors. 402 | */ 403 | inline Vector Vector::Max(const Vector& a, const Vector& b) 404 | { 405 | return Vector(a[0] > b[0] ? a[0] : b[0], a[1] > b[1] ? a[1] : b[1], a[2] > b[2] ? a[2] : b[2]); 406 | } 407 | 408 | /*! 409 | \brief Clamp a vector between two bounds. 410 | \param x Input vector 411 | \param a, b %Vector bounds. 412 | */ 413 | inline Vector Clamp(const Vector& x, const Vector& a, const Vector& b) 414 | { 415 | return Vector(Math::Clamp(x[0], a[0], b[0]), Math::Clamp(x[1], a[1], b[1]), Math::Clamp(x[2], a[2], b[2])); 416 | } 417 | 418 | /*! 419 | \brief Linear interpolation between two vectors. 420 | \param a,b Interpolated points. 421 | \param t Interpolant. 422 | */ 423 | inline Vector Lerp(const Vector& a, const Vector& b, const double& t) 424 | { 425 | return a + t * (b - a); 426 | } 427 | 428 | /*! 429 | \brief Compute the point on a segment such that the linear function satisfies f(a)=va and f(b)=vb. 430 | 431 | This function can be used as a first approximation for computing the intersection between a segment and an implicit surface. 432 | \image html intersection.png 433 | 434 | \sa Linear::Solve(const double& a, const double& b, const Vector&, const Vector&); 435 | */ 436 | inline Vector Vector::Solve(const Vector& a, const Vector& b, const double& va, const double& vb) 437 | { 438 | return (vb * a - va * b) / (vb - va); 439 | } 440 | 441 | #endif 442 | 443 | -------------------------------------------------------------------------------- /Code/Include/fundamentals.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "evector.h" 3 | 4 | // Annoying & useless MSVC warning 5 | #pragma warning(disable: 6387 26812) 6 | 7 | inline double Epsilon() 8 | { 9 | return 1e-3; 10 | } 11 | 12 | class Ray 13 | { 14 | public: 15 | Vector o; 16 | Vector d; 17 | 18 | Ray(const Vector& pp, const Vector& dd); 19 | Vector operator()(double t) const; 20 | }; 21 | 22 | class Box 23 | { 24 | private: 25 | Vector a; 26 | Vector b; 27 | 28 | public: 29 | Box(); 30 | Box(const Vector& aa, const Vector& bb); 31 | Box(const Box& b1, const Box& b2); 32 | 33 | bool Inside(const Vector& p) const; 34 | int Intersect(const Ray& ray, double& tmin, double& tmax, double epsilon = 1e-3) const; 35 | bool Intersect(const Box& box) const; 36 | Vector operator[](int i) const; 37 | Vector Diagonal() const; 38 | Vector Center() const; 39 | }; 40 | 41 | class Segment 42 | { 43 | private: 44 | Vector a; 45 | Vector b; 46 | 47 | public: 48 | Segment(); 49 | Segment(const Vector& aa, const Vector& bb); 50 | 51 | Vector operator[](int i) const; 52 | bool Intersect(const Box& box) const; 53 | Box GetBox() const; 54 | }; 55 | -------------------------------------------------------------------------------- /Code/Include/mathematics.h: -------------------------------------------------------------------------------- 1 | // Fundamentals 2 | 3 | #ifndef __Mathematics__ 4 | #define __Mathematics__ 5 | 6 | #include 7 | 8 | #ifdef min 9 | #undef min 10 | #endif 11 | 12 | #ifdef max 13 | #undef max 14 | #endif 15 | 16 | /*! 17 | \brief Minimum of two integers. 18 | */ 19 | inline int min(int a, int b) 20 | { 21 | return (a < b ? a : b); 22 | } 23 | 24 | /*! 25 | \brief Minimum of two unsigned integers. 26 | */ 27 | inline unsigned int min(unsigned int a, unsigned int b) 28 | { 29 | return (a < b ? a : b); 30 | } 31 | 32 | /*! 33 | \brief Maximum of two integers. 34 | */ 35 | inline int max(int a, int b) 36 | { 37 | return (a > b ? a : b); 38 | } 39 | 40 | /*! 41 | \brief Minimum of two doubles. 42 | */ 43 | inline float min(const float& a, const float& b) 44 | { 45 | return (a < b ? a : b); 46 | } 47 | 48 | /*! 49 | \brief Maximum of two doubles. 50 | */ 51 | inline float max(const float& a, const float& b) 52 | { 53 | return (a > b ? a : b); 54 | } 55 | 56 | /*! 57 | \brief Minimum of two doubles. 58 | */ 59 | inline double min(const double& a, const double& b) 60 | { 61 | return (a < b ? a : b); 62 | } 63 | 64 | /*! 65 | \brief Maximum of two doubles. 66 | */ 67 | inline double max(const double& a, const double& b) 68 | { 69 | return (a > b ? a : b); 70 | } 71 | 72 | /*! 73 | \brief Minimum of three doubles. 74 | */ 75 | inline double min(const double& a, const double& b, const double& c) 76 | { 77 | return min(min(a, b), c); 78 | } 79 | 80 | /*! 81 | \brief Maximum of three doubles. 82 | */ 83 | inline double max(const double& a, const double& b, const double& c) 84 | { 85 | return max(max(a, b), c); 86 | } 87 | 88 | /*! 89 | \brief Minimum of four doubles. 90 | */ 91 | inline double min(const double& a, const double& b, const double& c, const double& d) 92 | { 93 | return min(min(a, b), min(c, d)); 94 | } 95 | 96 | /*! 97 | \brief Maximum of four doubles. 98 | */ 99 | inline double max(const double& a, const double& b, const double& c, const double& d) 100 | { 101 | return max(max(a, b), max(c, d)); 102 | } 103 | 104 | /*! 105 | \brief Minimum of four integers. 106 | */ 107 | inline int min(int a, int b, int c, int d) 108 | { 109 | return min(min(a, b), min(c, d)); 110 | } 111 | 112 | /*! 113 | \brief Minimum of four unsigned integers. 114 | */ 115 | inline unsigned int min(unsigned int a, unsigned int b, unsigned int c, unsigned int d) 116 | { 117 | return min(min(a, b), min(c, d)); 118 | } 119 | 120 | /*! 121 | \brief Maximum of four integers. 122 | */ 123 | inline int max(int a, int b, int c, int d) 124 | { 125 | return max(max(a, b), max(c, d)); 126 | } 127 | 128 | //! Clamps an integer value between two bounds. 129 | inline int Clamp(int x, int a, int b) 130 | { 131 | return (x < a ? a : (x > b ? b : x)); 132 | } 133 | 134 | //! Clamps a double value between two bounds. 135 | inline double Clamp(double x, double a, double b) 136 | { 137 | return (x < a ? a : (x > b ? b : x)); 138 | } 139 | 140 | //! Clamps a double value between two bounds. 141 | inline float Clamp(float x, float a, float b) 142 | { 143 | return (x < a ? a : (x > b ? b : x)); 144 | } 145 | 146 | // Math class for constants 147 | class Math 148 | { 149 | public: 150 | static const double Pi; //!< Pi. 151 | static const double HalfPi; //!< Half of pi. 152 | static const double e; //!< Exponential. 153 | static const double TwoPiOverThree; //!< 2/3 Pi. 154 | static const double FourPiOverThree; //!< 4/3 Pi. 155 | static const double Infinity; //! Infinity 156 | static const double Sqrt5; //!< Constant √5 157 | static const double Sqrt3; //!< Constant √3 158 | static const double Sqrt2; //!< Constant √2 159 | static const double Golden; //!< Constant (√5+1)/2 160 | public: 161 | static double Clamp(const double&, const double& = 0.0, const double& = 1.0); 162 | static int Clamp(int, int = 0, int = 255); 163 | 164 | // Squares 165 | static double Abs(const double&); 166 | 167 | // Minimum and maximum 168 | static double Min(const double&, const double&); 169 | static double Max(const double&, const double&); 170 | static double Min(const double&, const double&, const double&); 171 | static double Max(const double&, const double&, const double&); 172 | static double Min(const double&, const double&, const double&, const double&); 173 | static double Max(const double&, const double&, const double&, const double&); 174 | 175 | // Angles 176 | static double DegreeToRadian(const double&); 177 | static double RadianToDegree(const double&); 178 | }; 179 | 180 | /*! 181 | \brief Convert degrees to randians. 182 | \param a Angle in degrees. 183 | */ 184 | inline double Math::DegreeToRadian(const double& a) 185 | { 186 | return a * Math::Pi / 180.0; 187 | } 188 | 189 | /*! 190 | \brief Convert radian to degrees. 191 | \param a Angle in radian. 192 | */ 193 | inline double Math::RadianToDegree(const double& a) 194 | { 195 | return a * 180.0 / Math::Pi; 196 | } 197 | 198 | /*! 199 | \brief Clamp a double value between two bounds. 200 | \param x Input value. 201 | \param a, b Lower and upper bounds. 202 | */ 203 | inline double Math::Clamp(const double& x, const double& a, const double& b) 204 | { 205 | return (x < a ? a : (x > b ? b : x)); 206 | } 207 | 208 | /*! 209 | \brief Clamp an integer value between two bounds. 210 | \param x Input value. 211 | \param a, b Lower and upper bounds. 212 | */ 213 | inline int Math::Clamp(int x, int a, int b) 214 | { 215 | return (x < a ? a : (x > b ? b : x)); 216 | } 217 | 218 | /*! 219 | \brief Minimum of two reals. 220 | \param a, b Real values. 221 | */ 222 | inline double Math::Min(const double& a, const double& b) 223 | { 224 | return (a < b ? a : b); 225 | } 226 | 227 | /*! 228 | \brief Maximum of two reals. 229 | \param a, b Real values. 230 | */ 231 | inline double Math::Max(const double& a, const double& b) 232 | { 233 | return (a > b ? a : b); 234 | } 235 | 236 | /*! 237 | \brief Maximum of three reals. 238 | \param a, b, c Real values. 239 | */ 240 | inline double Math::Max(const double& a, const double& b, const double& c) 241 | { 242 | return Math::Max(Math::Max(a, b), c); 243 | } 244 | 245 | /*! 246 | \brief Minimum of three reals. 247 | \param a, b, c Real values. 248 | */ 249 | inline double Math::Min(const double& a, const double& b, const double& c) 250 | { 251 | return Math::Min(Math::Min(a, b), c); 252 | } 253 | 254 | /*! 255 | \brief Maximum of four reals. 256 | \param a, b, c, d Real values. 257 | */ 258 | inline double Math::Max(const double& a, const double& b, const double& c, const double& d) 259 | { 260 | return Math::Max(Math::Max(a, b), Math::Max(c, d)); 261 | } 262 | 263 | /*! 264 | \brief Minimum of four reals. 265 | \param a, b, c, d Real values. 266 | */ 267 | inline double Math::Min(const double& a, const double& b, const double& c, const double& d) 268 | { 269 | return Math::Min(Math::Min(a, b), Math::Min(c, d)); 270 | } 271 | 272 | /*! 273 | \brief Absolute value. 274 | 275 | \param x Real. 276 | */ 277 | inline double Math::Abs(const double& x) 278 | { 279 | return fabs(x); 280 | } 281 | 282 | #endif 283 | -------------------------------------------------------------------------------- /Code/Source/blobtree.cpp: -------------------------------------------------------------------------------- 1 | #include "blobtree.h" 2 | #include 3 | 4 | 5 | /*! 6 | \brief Constructor for a bounded node. 7 | \param b bounding box 8 | */ 9 | BlobTreeNode::BlobTreeNode(const Box& b) 10 | { 11 | box = b; 12 | k = 1.0f; 13 | } 14 | 15 | /* 16 | \brief Computes the gradient of the node at a given point in space. 17 | \param p point 18 | */ 19 | Vector BlobTreeNode::Gradient(const Vector& p) const 20 | { 21 | double x = Intensity(Vector(p[0] + Epsilon(), p[1], p[2])) - Intensity(Vector(p[0] - Epsilon(), p[1], p[2])); 22 | double y = Intensity(Vector(p[0], p[1] + Epsilon(), p[2])) - Intensity(Vector(p[0], p[1] - Epsilon(), p[2])); 23 | double z = Intensity(Vector(p[0], p[1], p[2] + Epsilon())) - Intensity(Vector(p[0], p[1], p[2] - Epsilon())); 24 | return Vector(x, y, z) / (2.0f * Epsilon()); 25 | } 26 | 27 | 28 | /*! 29 | \brief Constructor for a binary blending node. 30 | \param e1 first child 31 | \param e2 second child 32 | */ 33 | BlobTreeBlend::BlobTreeBlend(BlobTreeNode* e1, BlobTreeNode* e2) : BlobTreeNode(Box(e1->GetBox(), e2->GetBox())) 34 | { 35 | e[0] = e1; 36 | e[1] = e2; 37 | } 38 | 39 | /*! 40 | \brief Computes the intensity of the tree at a given point. 41 | \param p point 42 | */ 43 | double BlobTreeBlend::Intensity(const Vector& p) const 44 | { 45 | if (!box.Inside(p)) 46 | return 0.0; 47 | return e[0]->Intensity(p) + e[1]->Intensity(p); 48 | } 49 | 50 | /*! 51 | \brief Computes the gradient of the tree at a given point. 52 | \param p point 53 | */ 54 | Vector BlobTreeBlend::Gradient(const Vector& p) const 55 | { 56 | if (!box.Inside(p)) 57 | return Vector(0.0); 58 | return e[0]->Gradient(p) + e[1]->Gradient(p); 59 | } 60 | 61 | /*! 62 | \brief Computes the global lipschitz constant as a recursive query. 63 | */ 64 | double BlobTreeBlend::K() const 65 | { 66 | return e[0]->K() + e[1]->K(); 67 | } 68 | 69 | /*! 70 | \brief Computes the local lipschitz constant over a segment. 71 | \param s segment 72 | */ 73 | double BlobTreeBlend::K(const Segment& s) const 74 | { 75 | if (!box.Intersect(s.GetBox())) 76 | return 0.0; 77 | return e[0]->K(s) + e[1]->K(s); 78 | } 79 | 80 | 81 | /*! 82 | \brief Constructor for a point primitive. 83 | \param pp center 84 | \param rr radius 85 | \param ee intensity 86 | */ 87 | BlobTreePoint::BlobTreePoint(const Vector& pp, double rr, double ee) : BlobTreeNode(Box(pp - Vector(rr, rr, rr), pp + Vector(rr, rr, rr))) 88 | { 89 | c = pp; 90 | r = rr; 91 | e = ee; 92 | k = CubicFalloffK(e, r); 93 | } 94 | 95 | /*! 96 | \brief Computes the intensity of the tree at a given point. 97 | \param p point 98 | */ 99 | double BlobTreePoint::Intensity(const Vector& p) const 100 | { 101 | if (!box.Inside(p)) 102 | return 0.0; 103 | Vector delta = p - c; 104 | return CubicFalloff(delta * delta, r * r); 105 | } 106 | 107 | /*! 108 | \brief Computes the local lipschitz constant over a segment. 109 | \param s segment 110 | */ 111 | double BlobTreePoint::K(const Segment& s) const 112 | { 113 | Vector a = s[0]; 114 | Vector b = s[1]; 115 | if (!s.Intersect(box)) 116 | return 0.0f; 117 | Vector axis = Normalized(b - a); 118 | double l = (c - a) * axis; 119 | double kk = 0.0; 120 | if (l < 0.0) 121 | { 122 | kk = CubicFalloffK(SquaredNorm(c - a), SquaredNorm(c - b), r, e); 123 | } 124 | else if (Norm(b - a) < l) 125 | { 126 | kk = CubicFalloffK(SquaredNorm(c - b), SquaredNorm(c - a), r, e); 127 | } 128 | else 129 | { 130 | double dd = SquaredNorm(c - a) - (l * l); 131 | Vector pc = a + axis * l; 132 | kk = CubicFalloffK(dd, Math::Max(SquaredNorm(c - b), SquaredNorm(c - a)), r, e); 133 | } 134 | double grad = Math::Max(Math::Abs(axis * Normalized(c - a)), Math::Abs(axis * Normalized(c - b))); 135 | return kk * grad; 136 | } 137 | 138 | /*! 139 | \brief Create a bounding box hierarchy. 140 | \param pts Set of nodes. 141 | \param begin, end Indexes of the nodes that should be organized into the hierarchy. 142 | */ 143 | BlobTreeNode* BlobTreePoint::BVHRecursive(std::vector& pts, int begin, int end) 144 | { 145 | /* 146 | \brief BVH space partition predicate. Could also use a lambda function to avoid the structure. 147 | */ 148 | struct BVHPartitionPredicate 149 | { 150 | int axis; 151 | double cut; 152 | 153 | BVHPartitionPredicate(int a, double c) : axis(a), cut(c) 154 | { 155 | } 156 | 157 | bool operator()(BlobTreeNode* p) const 158 | { 159 | return (p->GetBox().Center()[axis] < cut); 160 | } 161 | }; 162 | 163 | // If leaf, returns primitive 164 | int nodeCount = end - begin; 165 | if (nodeCount <= 1) 166 | return pts[begin]; 167 | 168 | // Bounding box of primitive in [begin, end] range 169 | Box bbox = pts[begin]->GetBox(); 170 | for (int i = begin + 1; i < end; i++) 171 | bbox = Box(bbox, pts[i]->GetBox()); 172 | 173 | // Find the most stretched axis of the bounding box 174 | // Cut the box in the middle of this stretched axis 175 | int stretchedAxis = bbox.Diagonal().MaxIndex(); 176 | double axisMiddleCut = (bbox[0][stretchedAxis] + bbox[1][stretchedAxis]) / 2.0f; 177 | 178 | // Partition our primitives in relation to the axisMiddleCut 179 | auto pmid = std::partition(pts.begin() + begin, pts.begin() + end, BVHPartitionPredicate(stretchedAxis, axisMiddleCut)); 180 | 181 | // Ensure the partition is not degenerate : all primitives on the same side 182 | int midIndex = int(std::distance(pts.begin(), pmid)); 183 | if (midIndex == begin || midIndex == end) 184 | midIndex = (begin + end) / 2; 185 | 186 | // Recursive construction of sub trees 187 | BlobTreeNode* left = BVHRecursive(pts, begin, midIndex); 188 | BlobTreeNode* right = BVHRecursive(pts, midIndex, end); 189 | 190 | // Blend of the two child nodes 191 | return new BlobTreeBlend(left, right); 192 | } 193 | 194 | /*! 195 | \brief Recursive BVH Tree construction from a vector. 196 | \param begin start index 197 | \param end end index 198 | */ 199 | BlobTreeNode* BlobTreePoint::OptimizeHierarchy(std::vector& pts, int begin, int end) 200 | { 201 | if (pts.empty()) 202 | return nullptr; 203 | return BVHRecursive(pts, begin, end); 204 | } 205 | 206 | /*! 207 | \brief Entry point of the BVH construction. 208 | \param c vector of position in world space, for all sphere primitives 209 | \param r radius for all primitives. 210 | */ 211 | BlobTreeNode* BlobTreePoint::OptimizeHierarchy(const std::vector& c, double r) 212 | { 213 | std::vector all(c.size()); 214 | for (int i = 0; i < c.size(); i++) 215 | all[i] = new BlobTreePoint(c[i], r, 1.0f); 216 | return OptimizeHierarchy(all, 0, int(all.size())); 217 | } 218 | 219 | 220 | /*! 221 | \brief Default constructor. 222 | */ 223 | BlobTree::BlobTree() 224 | { 225 | root = nullptr; 226 | } 227 | 228 | /*! 229 | \brief Constructor from a node. 230 | \param rr root node 231 | */ 232 | BlobTree::BlobTree(BlobTreeNode* rr) 233 | { 234 | root = rr; 235 | } 236 | 237 | /*! 238 | \brief Utility constructor for building the tree from a file containing sphere primitives. 239 | \param path file path 240 | */ 241 | BlobTree::BlobTree(const char* path) 242 | { 243 | std::vector centers; 244 | std::ifstream inFile; 245 | inFile.open(path); 246 | if (!inFile) 247 | { 248 | std::cout << "Unable to open particle file - exiting." << std::endl; 249 | root = nullptr; 250 | return; 251 | } 252 | for (std::string line; std::getline(inFile, line); /* empty */) 253 | { 254 | std::istringstream in(line); 255 | double x, y, z; 256 | in >> x >> y >> z; 257 | centers.push_back(Vector(x, y, z)); // Upscale all the vector field 258 | } 259 | root = BlobTreePoint::OptimizeHierarchy(centers, 2.25); // Hardcoded radius for the file 260 | std::cout << "Primitive count: " << centers.size() << std::endl << std::endl; 261 | } 262 | 263 | /*! 264 | \brief Computes the intensity of the tree at a given point. 265 | \param p point 266 | */ 267 | double BlobTree::Intensity(const Vector& p) 268 | { 269 | return root->Intensity(p) - 0.5f; 270 | } 271 | 272 | /*! 273 | \brief Computes the gradient of the tree at a given point. 274 | \param p point 275 | */ 276 | Vector BlobTree::Gradient(const Vector& p) const 277 | { 278 | return root->Gradient(p); 279 | } 280 | 281 | /*! 282 | \brief Computes the global lipschitz constant as a recursive query. 283 | */ 284 | double BlobTree::K() const 285 | { 286 | return root->K(); 287 | } 288 | 289 | /*! 290 | \brief Computes the local lipschitz constant over a segment. 291 | \param s segment 292 | */ 293 | double BlobTree::K(const Segment& s) const 294 | { 295 | return root->K(s); 296 | } 297 | 298 | /*! 299 | \brief Computes and returns the bounding box of the construction tree, as a recursive query. 300 | */ 301 | Box BlobTree::GetBox() const 302 | { 303 | return root->GetBox(); 304 | } 305 | -------------------------------------------------------------------------------- /Code/Source/evector.cpp: -------------------------------------------------------------------------------- 1 | #include "evector.h" 2 | 3 | /*! 4 | \class Vector evector.h 5 | \brief Vectors in three dimensions. 6 | */ 7 | 8 | const Vector Vector::Null = Vector(0.0, 0.0, 0.0); 9 | 10 | /*! 11 | \brief Normalize a vector, computing the inverse of its norm and scaling 12 | the components. 13 | 14 | This function does not check if the vector is null, 15 | which might resulting in errors. 16 | */ 17 | void Normalize(Vector& u) 18 | { 19 | u *= 1.0 / Norm(u); 20 | } 21 | 22 | /*! 23 | \brief Swap two vectors. 24 | \param a, b Vectors. 25 | */ 26 | void Swap(Vector& a, Vector& b) 27 | { 28 | Vector t = a; 29 | a = b; 30 | b = t; 31 | } 32 | 33 | /*! 34 | \brief Returns a vector orthogonal to the argument vector. 35 | 36 | The returned orthogonal vector is not computed randomly. 37 | First, we find the two coordinates of the argument vector with 38 | maximum absolute value. The orthogonal vector is defined by 39 | swapping those two coordinates and changing one sign, whereas 40 | the third coordinate is set to 0. 41 | 42 | The returned orthogonal vector lies in the plane orthogonal 43 | to the first vector. 44 | */ 45 | Vector Vector::Orthogonal() const 46 | { 47 | Vector a = Abs(*this); 48 | int i = 0; 49 | int j = 1; 50 | if (a[0] > a[1]) 51 | { 52 | if (a[2] > a[1]) 53 | { 54 | j = 2; 55 | } 56 | } 57 | else 58 | { 59 | i = 1; 60 | j = 2; 61 | if (a[0] > a[2]) 62 | { 63 | j = 0; 64 | } 65 | } 66 | a = Vector(0.0); 67 | a[i] = c[j]; 68 | a[j] = -c[i]; 69 | return a; 70 | } 71 | 72 | /*! 73 | \brief Given a vector, creates two vectors xand y that form an orthogonal basis. 74 | 75 | This algorithm pickes the minor axis in order to reduce numerical instability 76 | \param x, y Returned vectors such that (x,y,n) form an orthonormal basis (provided n is normalized). 77 | */ 78 | void Vector::Orthonormal(Vector& x, Vector& y) const 79 | { 80 | x = Normalized(Orthogonal()); 81 | y = Normalized(*this / x); 82 | } 83 | -------------------------------------------------------------------------------- /Code/Source/fundamentals.cpp: -------------------------------------------------------------------------------- 1 | #include "fundamentals.h" 2 | 3 | /*! 4 | \brief 5 | */ 6 | Ray::Ray(const Vector& pp, const Vector& dd) 7 | { 8 | o = pp; 9 | d = dd; 10 | } 11 | 12 | /*! 13 | \brief 14 | */ 15 | Vector Ray::operator()(double t) const 16 | { 17 | return o + t * d; 18 | } 19 | 20 | 21 | /*! 22 | \brief 23 | */ 24 | Box::Box() 25 | { 26 | a = b = Vector(0); 27 | } 28 | 29 | /*! 30 | \brief 31 | */ 32 | Box::Box(const Vector& aa, const Vector& bb) 33 | { 34 | a = aa; 35 | b = bb; 36 | } 37 | 38 | /*! 39 | \brief 40 | */ 41 | Box::Box(const Box& b1, const Box& b2) 42 | { 43 | a = Vector::Min(b1.a, b2.a); 44 | b = Vector::Max(b1.b, b2.b); 45 | } 46 | 47 | /*! 48 | \brief 49 | */ 50 | bool Box::Inside(const Vector& p) const 51 | { 52 | return (p > a&& p < b); 53 | } 54 | 55 | /*! 56 | \brief 57 | */ 58 | int Box::Intersect(const Ray& ray, double& tmin, double& tmax, double epsilon) const 59 | { 60 | tmin = -1e16; 61 | tmax = 1e16; 62 | 63 | Vector p = ray.o; 64 | Vector d = ray.d; 65 | 66 | double t; 67 | // Ox 68 | if (d[0] < -epsilon) 69 | { 70 | t = (a[0] - p[0]) / d[0]; 71 | if (t < tmin) 72 | return 0; 73 | if (t <= tmax) 74 | tmax = t; 75 | t = (b[0] - p[0]) / d[0]; 76 | if (t >= tmin) 77 | { 78 | if (t > tmax) 79 | return 0; 80 | tmin = t; 81 | } 82 | } 83 | else if (d[0] > epsilon) 84 | { 85 | t = (b[0] - p[0]) / d[0]; 86 | if (t < tmin) 87 | return 0; 88 | if (t <= tmax) 89 | tmax = t; 90 | t = (a[0] - p[0]) / d[0]; 91 | if (t >= tmin) 92 | { 93 | if (t > tmax) 94 | return 0; 95 | tmin = t; 96 | } 97 | } 98 | else if (p[0]b[0]) 99 | return 0; 100 | 101 | // Oy 102 | if (d[1] < -epsilon) 103 | { 104 | t = (a[1] - p[1]) / d[1]; 105 | if (t < tmin) 106 | return 0; 107 | if (t <= tmax) 108 | tmax = t; 109 | t = (b[1] - p[1]) / d[1]; 110 | if (t >= tmin) 111 | { 112 | if (t > tmax) 113 | return 0; 114 | tmin = t; 115 | } 116 | } 117 | else if (d[1] > epsilon) 118 | { 119 | t = (b[1] - p[1]) / d[1]; 120 | if (t < tmin) 121 | return 0; 122 | if (t <= tmax) 123 | tmax = t; 124 | t = (a[1] - p[1]) / d[1]; 125 | if (t >= tmin) 126 | { 127 | if (t > tmax) 128 | return 0; 129 | tmin = t; 130 | } 131 | } 132 | else if (p[1]b[1]) 133 | return 0; 134 | 135 | // Oz 136 | if (d[2] < -epsilon) 137 | { 138 | t = (a[2] - p[2]) / d[2]; 139 | if (t < tmin) 140 | return 0; 141 | if (t <= tmax) 142 | tmax = t; 143 | t = (b[2] - p[2]) / d[2]; 144 | if (t >= tmin) 145 | { 146 | if (t > tmax) 147 | return 0; 148 | tmin = t; 149 | } 150 | } 151 | else if (d[2] > epsilon) 152 | { 153 | t = (b[2] - p[2]) / d[2]; 154 | if (t < tmin) 155 | return 0; 156 | if (t <= tmax) 157 | tmax = t; 158 | t = (a[2] - p[2]) / d[2]; 159 | if (t >= tmin) 160 | { 161 | if (t > tmax) 162 | return 0; 163 | tmin = t; 164 | } 165 | } 166 | else if (p[2]b[2]) 167 | return 0; 168 | 169 | return 1; 170 | } 171 | 172 | /*! 173 | \brief 174 | */ 175 | bool Box::Intersect(const Box& box) const 176 | { 177 | if (((a[0] >= box.b[0]) || (a[1] >= box.b[1]) || (a[2] >= box.b[2]) || (b[0] <= box.a[0]) || (b[1] <= box.a[1]) || (b[2] <= box.a[2]))) 178 | return false; 179 | else 180 | return true; 181 | } 182 | 183 | /*! 184 | \brief 185 | */ 186 | Vector Box::operator[](int i) const 187 | { 188 | if (i == 0) 189 | return a; 190 | return b; 191 | } 192 | 193 | /*! 194 | \brief 195 | */ 196 | Vector Box::Diagonal() const 197 | { 198 | return b - a; 199 | } 200 | 201 | /*! 202 | \brief 203 | */ 204 | Vector Box::Center() const 205 | { 206 | return 0.5 * (a + b); 207 | } 208 | 209 | 210 | /*! 211 | \brief 212 | */ 213 | Segment::Segment() 214 | { 215 | a = b = Vector(0); 216 | } 217 | 218 | /*! 219 | \brief 220 | */ 221 | Segment::Segment(const Vector& aa, const Vector& bb) 222 | { 223 | a = aa; 224 | b = bb; 225 | } 226 | 227 | /*! 228 | \brief 229 | */ 230 | Vector Segment::operator[](int i) const 231 | { 232 | if (i == 0) 233 | return a; 234 | return b; 235 | } 236 | 237 | /*! 238 | \brief 239 | */ 240 | bool Segment::Intersect(const Box& box) const 241 | { 242 | Vector ba = box.Diagonal(); 243 | 244 | Vector d = 0.5 * (b - a); 245 | Vector c = 0.5 * (a + b); 246 | 247 | double fd[3]; 248 | Vector cc = c - box.Center(); 249 | 250 | fd[0] = fabs(d[0]); 251 | if (fabs(cc[0]) > ba[0] + fd[0]) 252 | return false; 253 | 254 | fd[1] = fabs(d[1]); 255 | if (fabs(cc[1]) > ba[1] + fd[1]) 256 | return false; 257 | 258 | fd[2] = fabs(d[2]); 259 | if (fabs(cc[2]) > ba[2] + fd[2]) 260 | return false; 261 | 262 | if (fabs(d[1] * cc[2] - d[2] * cc[1]) > ba[1] * fd[2] + ba[2] * fd[1]) 263 | return false; 264 | 265 | if (fabs(d[2] * cc[0] - d[0] * cc[2]) > ba[0] * fd[2] + ba[2] * fd[0]) 266 | return false; 267 | 268 | if (fabs(d[0] * cc[1] - d[1] * cc[0]) > ba[0] * fd[1] + ba[1] * fd[0]) 269 | return false; 270 | 271 | return true; 272 | } 273 | 274 | /*! 275 | \brief 276 | */ 277 | Box Segment::GetBox() const 278 | { 279 | return Box(Vector::Min(a, b), Vector::Max(a, b)); 280 | } 281 | -------------------------------------------------------------------------------- /Code/Source/main.cpp: -------------------------------------------------------------------------------- 1 | #include // high resolution timer 2 | #include // std::cout 3 | #include "blobtree.h" // Implicit construction tree 4 | 5 | // Render parameters as global file variable 6 | const int imgWidth = 500; 7 | const int imgHeight = 500; 8 | const Vector sunDir = Vector(0.0f, -1.0f, 0.0f); 9 | const Vector camera = Vector(0.0f, -80.0f, 0.0f); 10 | BlobTree* tree = new BlobTree("../Scenes/particles.txt"); 11 | 12 | enum RayTraceMethod 13 | { 14 | SphereTracing = 0, 15 | EnhancedSphereTracing = 1, 16 | SegmentTracing = 2, 17 | COUNT = 3 18 | }; 19 | 20 | /*! 21 | \brief Compute a ray from a pixel coordinates. 22 | \param px pixel coordinate 23 | \param py pixel coordinate 24 | \return the ray going through this pixel. 25 | */ 26 | Ray ComputeRayFromPixel(int px, int py) 27 | { 28 | // Camera parameters 29 | const double cah = 1.995; 30 | const double cav = 1.5; 31 | const double fl = 35.0; 32 | 33 | // Get coordinates 34 | Vector view = Normalized(-camera); 35 | Vector horizontal = Normalized(view / Vector(0, 0, 1.0f)); 36 | Vector vertical = Normalized(horizontal / view); 37 | const double length = 1.0f; 38 | 39 | double avh = 2.0 * atan(cah * 25.4 * 0.5 / fl); 40 | double avv = 2.0 * atan(tan(avh / 2.0) * double(imgHeight) / double(imgWidth)); 41 | double rad = avv; // Fov 42 | 43 | double vLength = tan(rad / 2.0f) * length; 44 | double hLength = vLength * (double(imgWidth) / double(imgHeight)); 45 | vertical *= vLength; 46 | horizontal *= hLength; 47 | 48 | // Translate mouse coordinates so that the origin lies in the center of the view port 49 | double x = px - imgWidth / 2.0; 50 | double y = imgHeight / 2.0 - py; 51 | 52 | // Scale mouse coordinates so that half the view port width and height becomes 1.0 53 | x /= imgWidth / 2.0; 54 | y /= imgHeight / 2.0; 55 | 56 | // Direction is a linear combination to compute intersection of picking ray with view port plane 57 | return Ray(camera, Normalized(view * length + horizontal * x + vertical * y)); 58 | } 59 | 60 | /*! 61 | \brief Sphere tracing for a ray 62 | \param ray the ray 63 | \param t returned intersection depth 64 | \param s returned step count 65 | \param k global lipschitz constant 66 | \return true of intersection occured, false otherwise. 67 | */ 68 | bool SphereTrace(const Ray& ray, double& t, int& s, double k) 69 | { 70 | // First check intersection with bounding box 71 | double a, b; 72 | if (!tree->GetBox().Intersect(ray, a, b)) 73 | return false; 74 | 75 | // Classic sphere tracing using global lipschitz constant 76 | t = a; 77 | s = 0; 78 | while (t < b) 79 | { 80 | s++; 81 | double I = tree->Intensity(ray(t)); 82 | if (I > 0.0) 83 | return true; 84 | double ts = Math::Max(fabs(I) / k, Epsilon()); 85 | t += ts; 86 | } 87 | return false; 88 | } 89 | 90 | /*! 91 | \brief Enhanced sphere tracing for a ray 92 | \param ray the ray 93 | \param t returned intersection depth 94 | \param s returned step count 95 | \param k global lipschitz constant 96 | \return true of intersection occured, false otherwise. 97 | */ 98 | bool EnhancedSphereTrace(const Ray& ray, double& t, int& s, double k) 99 | { 100 | // First check intersection with bounding box 101 | double a, b; 102 | if (!tree->GetBox().Intersect(ray, a, b)) 103 | return false; 104 | 105 | // Enhanced sphere tracing using overstepping factor and global lipschitz constant 106 | t = a; 107 | s = 0; 108 | double e = 1.25; // Overstep factor in [1.0, 2.0] 109 | 110 | // Marching distance used in the previous step 111 | double te = 0.0; 112 | while (t < b) 113 | { 114 | s++; 115 | double i = tree->Intensity(ray(t)); 116 | 117 | // Got inside 118 | if (i > 0.0) 119 | return true; 120 | 121 | // Safe stepping distance 122 | double tk = fabs(i) / k; 123 | 124 | // We moved too far and the Lipschitz check fails: we need to move backward 125 | if (tk < (e - 1.0) * te) 126 | { 127 | t -= (e - 1.0) * te; 128 | te = 0.0; 129 | } 130 | // Over-estimated stepping distance is fine, so move on to the next position with over-estimated stepping distance 131 | else 132 | { 133 | te = tk; 134 | t += Math::Max(tk * e, Epsilon()); 135 | } 136 | } 137 | return false; 138 | } 139 | 140 | /*! 141 | \brief Segment tracing for a ray 142 | \param ray the ray 143 | \param t returned intersection depth 144 | \param s returned step count 145 | \return true of intersection occured, false otherwise. 146 | */ 147 | bool SegmentTrace(const Ray& ray, double& t, int& s) 148 | { 149 | // First check intersection with bounding box 150 | double a, b; 151 | if (!tree->GetBox().Intersect(ray, a, b)) 152 | return false; 153 | 154 | // Segment tracing using local lipschitz computation 155 | t = a; 156 | s = 0; 157 | double e = 1.0; // Overstep factor in [1.0, 2.0] 158 | double c = 1.5; // Acceleration factor defining the stepping distance increase factor 159 | 160 | // Start with a huge step 161 | double ts = (b - a); 162 | 163 | // Marching distance used in the previous step 164 | double te = 0.0; 165 | double ce = (e - 1.0); 166 | 167 | while (t < b) 168 | { 169 | s++; 170 | double i = tree->Intensity(ray(t)); 171 | 172 | // Got inside 173 | if (i > 0.0) 174 | return true; 175 | 176 | Vector pt = ray(t); 177 | Vector pts = ray(t + ts); 178 | double k = tree->K(Segment(pt, pts)); 179 | 180 | // Safe stepping distance 181 | double tk = fabs(i) / k; 182 | tk = Math::Min(tk, ts); 183 | ts = tk; 184 | 185 | // We moved too far and the Lipschitz check fails: move backward 186 | if (tk < ce * te) 187 | { 188 | t -= ce * te; 189 | te = 0.0; 190 | } 191 | // Over-estimated stepping distance is fine, so move on to the next position with over-estimated stepping distance 192 | else 193 | { 194 | te = Math::Max(tk * e, Epsilon()); 195 | t += te; 196 | } 197 | // Try to increase step bound 198 | ts = tk * c; 199 | } 200 | return false; 201 | } 202 | 203 | /*! 204 | \brief Compute a pixel color. 205 | \param i pixel coordinate 206 | \param j pixel coordinate 207 | \param k global lipschitz constant used for sphere tracing and enhanced sphere tracing 208 | \param method raytracing method 209 | \param color returned color for the pixel 210 | \param cost returned cost (as a RGBA color) for the pixel 211 | */ 212 | void PixelColor(int i, int j, double k, RayTraceMethod method, Vector& color, Vector& cost) 213 | { 214 | color = cost = Vector(0); 215 | 216 | // Compute ray 217 | Ray ray = ComputeRayFromPixel(i, j); 218 | 219 | // Compute intersection 220 | double t = 0.0; 221 | int s = 0; 222 | bool hit = false; 223 | switch (method) 224 | { 225 | case SphereTracing: 226 | hit = SphereTrace(ray, t, s, k); 227 | break; 228 | case EnhancedSphereTracing: 229 | hit = EnhancedSphereTrace(ray, t, s, k); 230 | break; 231 | case SegmentTracing: 232 | hit = SegmentTrace(ray, t, s); 233 | break; 234 | default: 235 | hit = false; 236 | break; 237 | }; 238 | 239 | // Compute pixel color 240 | if (hit) 241 | { 242 | // Hit position and normal 243 | Vector hitPosition = ray(t); 244 | Vector hitNormal = -Normalized(tree->Gradient(hitPosition)); 245 | 246 | // Diffuse lighting 247 | double NDotL = Math::Max(hitNormal * sunDir, 0.1); 248 | color = Vector(255 * NDotL, 0, 0); 249 | } 250 | 251 | // Compute cost 252 | // Unfair comparison (for us), but we can't see anything on the cost image using state of the art methods 253 | double div = (method == RayTraceMethod::SegmentTracing) ? 512 : 16384; 254 | double c = 0.0; 255 | c = Math::Min(double(s) / div, 1.0); 256 | cost = Vector(0, c * 255.0, 0); 257 | } 258 | 259 | /*! 260 | \brief Export an array of pixels in a ppm file. 261 | \param path file path 262 | \param pixels array of RGBA pixels. 263 | \return true of function terminated properly, false otherwise. 264 | */ 265 | bool WriteToFile(const char* path, Vector** pixels) 266 | { 267 | FILE* fp = NULL; 268 | fp = fopen(path, "wb"); 269 | if (fp == NULL) 270 | { 271 | std::cout << "Couldn't write to file - exiting" << std::endl; 272 | return false; 273 | } 274 | fprintf(fp, "P6\n%d %d\n255\n", imgWidth, imgHeight); 275 | for (int i = 0; i < imgHeight; i++) 276 | { 277 | for (int j = 0; j < imgWidth; j++) 278 | { 279 | static unsigned char color[3]; 280 | Vector c = pixels[j][i]; 281 | color[0] = ((int)c[0]) % 256; 282 | color[1] = ((int)c[1]) % 256; 283 | color[2] = ((int)c[2]) % 256; 284 | (void)fwrite(color, 1, 3, fp); 285 | } 286 | } 287 | fclose(fp); 288 | return true; 289 | } 290 | 291 | int main() 292 | { 293 | // Init pixels 294 | Vector** pixels = new Vector * [imgWidth]; 295 | Vector** pixelsCost = new Vector * [imgWidth]; 296 | for (int i = 0; i < imgWidth; i++) 297 | { 298 | pixels[i] = new Vector[imgHeight]; 299 | pixelsCost[i] = new Vector[imgHeight]; 300 | } 301 | 302 | // Global Lipschitz constant foe sphere tracing and enhanced sphere tracing 303 | const double k = tree->K(); 304 | 305 | int l = 0; // Put this line if Raytrace all methods: sphere tracing, enhanced sphere tracing and segment tracing 306 | //int l = RayTraceMethod::SegmentTracing; // With this line, the program will only use segment tracing. 307 | for (/* empty */; l < RayTraceMethod::COUNT; l++) 308 | { 309 | RayTraceMethod method = (RayTraceMethod)l; 310 | 311 | // Compute pixels 312 | std::chrono::steady_clock::time_point begin = std::chrono::steady_clock::now(); 313 | #pragma omp parallel for schedule(dynamic, 16) 314 | for (int i = 0; i < imgWidth; i++) 315 | { 316 | for (int j = 0; j < imgHeight; j++) 317 | { 318 | Vector col = Vector(0); 319 | Vector cost = Vector(0); 320 | PixelColor(i, j, k, method, col, cost); 321 | pixels[i][j] = col; 322 | pixelsCost[i][j] = cost; 323 | } 324 | } 325 | std::chrono::steady_clock::time_point end = std::chrono::steady_clock::now(); 326 | 327 | // Print stats 328 | std::cout << ((l == 0) ? "SphereTracing" : (l == 1) ? "Enhanced Sphere Tracing" : "Segment Tracing") << std::endl; 329 | long long milliseconds = std::chrono::duration_cast(end - begin).count(); 330 | int seconds = int(double(milliseconds) / 1000.0); 331 | std::cout << "Time: " << seconds << "s" << milliseconds % 1000 << "ms" << std::endl; 332 | 333 | // Output to ppm files 334 | char path[40]; 335 | char pathCost[40]; 336 | sprintf(path, "./render%d.ppm", l); 337 | sprintf(pathCost, "./render%d_cost.ppm", l); 338 | if (!WriteToFile(path, pixels)) 339 | std::cout << "WriteToFile Error - failed to write file 1 to disk" << std::endl; 340 | if (!WriteToFile(pathCost, pixelsCost)) 341 | std::cout << "WriteToFile Error - failed to write file 2 to disk" << std::endl; 342 | } 343 | 344 | // Free memory 345 | for (int i = 0; i < imgHeight; i++) 346 | { 347 | delete[] pixels[i]; 348 | delete[] pixelsCost[i]; 349 | } 350 | delete[] pixels; 351 | delete[] pixelsCost; 352 | 353 | return 0; 354 | } 355 | -------------------------------------------------------------------------------- /Code/Source/mathematics.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "mathematics.h" 4 | 5 | /*! 6 | \defgroup Math Core math classes. 7 | 8 | \brief Core math classes include several classes such as Vector, Quadric, Cubic and higher order 9 | polynomials and many others that are useful in many graphic applications. 10 | 11 | \changed 12.12.23 12 | */ 13 | 14 | /*! 15 | \class Math mathematics.h 16 | \brief Core class implementing some useful functions and constants. 17 | 18 |

How can I use the constant Pi? 19 |
Simply use the static constant Math::Pi as follows: 20 | \code 21 | double v=4.0*Math::Pi*r*r*r/3.0; // Volume of a sphere. 22 | \endcode 23 | Note that in this case, you could also have used: 24 | \code 25 | double v=Sphere::Volume(r); 26 | \endcode 27 | 28 |

How many min/max functions have been implemented? 29 |
Up to four arguments are supported; for a larger number of 30 | arguments, a specific routine operating on an array should be written. 31 | 32 |

Is there a function to compute the square of a real sumber? 33 |
Use the following: 34 | \code 35 | double s=Math::Sqr((1.0-sqrt(5.0))/2.0); // Square of golden ratio 36 | \endcode 37 | For a Vector, use SquaredNorm(const Vector&); 38 | 39 |

Are there predefined square roots constants? 40 |
The sqrt function used not te be constexpr, so square roots of reals are not computed at compilation time. 41 | Some constants are provided, such as the following one: 42 | \code 43 | double s=Math::Sqrt3; // Square root of 3 44 | \endcode 45 | 46 | \ingroup Math 47 | \changed 13.01.24 48 | 49 |

How are implemented the step and smooth-step functions that are often used in procedural modeling? 50 | Different smoothing kernels, such as Cubic::Smooth(), are implented in odd-degree polynomials Cubic, Quintic and Septic. 51 | The corresponding step functions, such as Cubic::SmoothStep(), are also implemented. 52 | \sa Linear::Step, Cubic::Smooth, Quintic::Smooth, Cubic::SmoothStep, Quintic::SmoothStep, Septic::SmoothStep. 53 | 54 | */ 55 | 56 | const double Math::Pi = 3.14159265358979323846; 57 | 58 | const double Math::HalfPi = Math::Pi / 2.0; 59 | 60 | const double Math::e = 2.7182818284590452354; 61 | 62 | const double Math::TwoPiOverThree = 2.0943951023931954923084; 63 | 64 | const double Math::FourPiOverThree = 4.1887902047863909846168; 65 | 66 | const double Math::Infinity = DBL_MAX; 67 | 68 | const double Math::Sqrt5 = sqrt(5.0); 69 | 70 | const double Math::Sqrt3 = sqrt(3.0); 71 | 72 | const double Math::Sqrt2 = sqrt(2.0); 73 | 74 | const double Math::Golden = (sqrt(5.0) + 1.0) / 2.0; 75 | -------------------------------------------------------------------------------- /G++/Makefile: -------------------------------------------------------------------------------- 1 | # GNU Make solution makefile autogenerated by Premake 2 | # Type "make help" for usage help 3 | 4 | ifndef config 5 | config=release64 6 | endif 7 | export config 8 | 9 | PROJECTS := SegmentTracing 10 | 11 | .PHONY: all clean help $(PROJECTS) 12 | 13 | all: $(PROJECTS) 14 | 15 | SegmentTracing: 16 | @echo "==== Building SegmentTracing ($(config)) ====" 17 | @${MAKE} --no-print-directory -C . -f SegmentTracing.make 18 | 19 | clean: 20 | @${MAKE} --no-print-directory -C . -f SegmentTracing.make clean 21 | 22 | help: 23 | @echo "Usage: make [config=name] [target]" 24 | @echo "" 25 | @echo "CONFIGURATIONS:" 26 | @echo " release64" 27 | @echo "" 28 | @echo "TARGETS:" 29 | @echo " all (default)" 30 | @echo " clean" 31 | @echo " SegmentTracing" 32 | @echo "" 33 | @echo "For more information, see http://industriousone.com/premake/quick-start" 34 | -------------------------------------------------------------------------------- /G++/SegmentTracing.make: -------------------------------------------------------------------------------- 1 | # GNU Make project makefile autogenerated by Premake 2 | ifndef config 3 | config=release64 4 | endif 5 | 6 | ifndef verbose 7 | SILENT = @ 8 | endif 9 | 10 | ifndef CC 11 | CC = gcc 12 | endif 13 | 14 | ifndef CXX 15 | CXX = g++ 16 | endif 17 | 18 | ifndef AR 19 | AR = ar 20 | endif 21 | 22 | ifeq ($(config),release64) 23 | OBJDIR = obj/x64 24 | TARGETDIR = Out 25 | TARGET = $(TARGETDIR)/SegmentTracing 26 | DEFINES += 27 | INCLUDES += -I. -I../Code/Include -I/usr/include 28 | CPPFLAGS += -MMD -MP $(DEFINES) $(INCLUDES) 29 | CFLAGS += $(CPPFLAGS) $(ARCH) -O3 -m64 -mtune=native -march=native -std=c++14 -w -flto -g 30 | CXXFLAGS += $(CFLAGS) 31 | LDFLAGS += -s -m64 -L/usr/lib64 -fopenmp -flto -g 32 | LIBS += 33 | RESFLAGS += $(DEFINES) $(INCLUDES) 34 | LDDEPS += 35 | LINKCMD = $(CXX) -o $(TARGET) $(OBJECTS) $(LDFLAGS) $(RESOURCES) $(ARCH) $(LIBS) 36 | define PREBUILDCMDS 37 | endef 38 | define PRELINKCMDS 39 | endef 40 | define POSTBUILDCMDS 41 | endef 42 | endif 43 | 44 | OBJECTS := \ 45 | $(OBJDIR)/evector.o \ 46 | $(OBJDIR)/fundamentals.o \ 47 | $(OBJDIR)/main.o \ 48 | $(OBJDIR)/mathematics.o \ 49 | $(OBJDIR)/blobtree.o \ 50 | 51 | RESOURCES := \ 52 | 53 | SHELLTYPE := msdos 54 | ifeq (,$(ComSpec)$(COMSPEC)) 55 | SHELLTYPE := posix 56 | endif 57 | ifeq (/bin,$(findstring /bin,$(SHELL))) 58 | SHELLTYPE := posix 59 | endif 60 | 61 | .PHONY: clean prebuild prelink 62 | 63 | all: $(TARGETDIR) $(OBJDIR) prebuild prelink $(TARGET) 64 | @: 65 | 66 | $(TARGET): $(GCH) $(OBJECTS) $(LDDEPS) $(RESOURCES) 67 | @echo Linking SegmentTracing 68 | $(SILENT) $(LINKCMD) 69 | $(POSTBUILDCMDS) 70 | 71 | $(TARGETDIR): 72 | @echo Creating $(TARGETDIR) 73 | ifeq (posix,$(SHELLTYPE)) 74 | $(SILENT) mkdir -p $(TARGETDIR) 75 | else 76 | $(SILENT) mkdir $(subst /,\\,$(TARGETDIR)) 77 | endif 78 | 79 | $(OBJDIR): 80 | @echo Creating $(OBJDIR) 81 | ifeq (posix,$(SHELLTYPE)) 82 | $(SILENT) mkdir -p $(OBJDIR) 83 | else 84 | $(SILENT) mkdir $(subst /,\\,$(OBJDIR)) 85 | endif 86 | 87 | clean: 88 | @echo Cleaning SegmentTracing 89 | ifeq (posix,$(SHELLTYPE)) 90 | $(SILENT) rm -f $(TARGET) 91 | $(SILENT) rm -rf $(OBJDIR) 92 | else 93 | $(SILENT) if exist $(subst /,\\,$(TARGET)) del $(subst /,\\,$(TARGET)) 94 | $(SILENT) if exist $(subst /,\\,$(OBJDIR)) rmdir /s /q $(subst /,\\,$(OBJDIR)) 95 | endif 96 | 97 | prebuild: 98 | $(PREBUILDCMDS) 99 | 100 | prelink: 101 | $(PRELINKCMDS) 102 | 103 | ifneq (,$(PCH)) 104 | $(GCH): $(PCH) 105 | @echo $(notdir $<) 106 | -$(SILENT) cp $< $(OBJDIR) 107 | $(SILENT) $(CXX) $(CXXFLAGS) -o "$@" -c "$<" 108 | endif 109 | 110 | $(OBJDIR)/evector.o: ../Code/Source/evector.cpp 111 | @echo $(notdir $<) 112 | $(SILENT) $(CXX) $(CXXFLAGS) -o "$@" -c "$<" 113 | $(OBJDIR)/fundamentals.o: ../Code/Source/fundamentals.cpp 114 | @echo $(notdir $<) 115 | $(SILENT) $(CXX) $(CXXFLAGS) -o "$@" -c "$<" 116 | $(OBJDIR)/main.o: ../Code/Source/main.cpp 117 | @echo $(notdir $<) 118 | $(SILENT) $(CXX) $(CXXFLAGS) -o "$@" -c "$<" 119 | $(OBJDIR)/mathematics.o: ../Code/Source/mathematics.cpp 120 | @echo $(notdir $<) 121 | $(SILENT) $(CXX) $(CXXFLAGS) -o "$@" -c "$<" 122 | $(OBJDIR)/blobtree.o: ../Code/Source/blobtree.cpp 123 | @echo $(notdir $<) 124 | $(SILENT) $(CXX) $(CXXFLAGS) -o "$@" -c "$<" 125 | 126 | -include $(OBJECTS:%.o=%.d) 127 | -------------------------------------------------------------------------------- /G++/premake4.lua: -------------------------------------------------------------------------------- 1 | solution "SegmentTracing" 2 | configurations { "release" } 3 | 4 | platforms { "x64" } 5 | 6 | includedirs { ".", "../Code/Include", "/usr/include/" } 7 | 8 | rootDir = path.getabsolute("../") 9 | 10 | configuration "release" 11 | targetdir "./Out/Release" 12 | flags { "OptimizeSpeed" } 13 | 14 | configuration "linux" 15 | buildoptions { "-mtune=native -march=native" } 16 | buildoptions { "-std=c++14" } 17 | buildoptions { "-w" } 18 | buildoptions { "-flto -g"} 19 | linkoptions { "-fopenmp"} 20 | linkoptions { "-flto"} 21 | linkoptions { "-g"} 22 | 23 | fileList = { rootDir .. "/Code/Source/*.cpp", rootDir .. "/Code/Include/*.h" } 24 | 25 | project("SegmentTracing") 26 | language "C++" 27 | kind "ConsoleApp" 28 | targetdir "Out" 29 | files ( fileList ) 30 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2019 Axel Paris 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, 4 | including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished 5 | to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 10 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH T 11 | HE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 12 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## Segment Tracing Using Local Lipschitz Bounds 2 | 3 | Segment Tracing - Representative Image 6 | 7 | Source code for some of the results shown in the paper "Segment Tracing Using Local Lipschitz Bounds" published in CGF in 2020 8 | and presented at Eurographics 2020. This is aimed at researchers, students or profesionnals who may want to reproduce **some** of the results described in the paper. 9 | 10 | [Project Page](https://aparis69.github.io/public_html/projects/galin2020_Segment.html) 11 | 12 | [Paper](https://hal.archives-ouvertes.fr/hal-02507361/document) 13 | 14 | This implementation has been labelled by the GRSI (Graphics Replicability Stamp Initiative), see [here](http://www.replicabilitystamp.org/) for more details. 15 | 16 | ### Important notes 17 | * This code is **not** the one which produced the scenes seen in the paper. Hence, results as well as timings may differ from the ones in the paper. 18 | * This is **research** code provided without any warranty. However, if you have any problem you can still send me an email or create an issue. 19 | 20 | ### Testing 21 | There is no dependency. Running the program will render two ppm file (render + cost) for the Segment tracing algorithm. Tests have been made on: 22 | * Visual Studio 2017: double click on the solution in ./VS2017/ and Ctrl + F5 to run 23 | * Visual Studio 2019: double click on the solution in ./VS2019/ and Ctrl + F5 to run 24 | * Visual Studio 2022: double click on the solution in ./VS2022/ and Ctrl + F5 to run 25 | * Ubuntu 16.04: cd G++/ && make && ./Out/SegmentTracing 26 | 27 | Results for comparing with other algorithms are also available in the Renders/ folder of the repository. You can also modify one line in the main.cpp file to test other methods, namely Sphere tracing and Enhanced sphere tracing. 28 | 29 | ### Citation 30 | You can use this code in any way you want, however please credit the original article: 31 | ``` 32 | @article{Galin2020, 33 |   Title = {{Segment Tracing Using Local Lipschitz Bounds}}, 34 |   Author = {Galin, Eric and Gu{\'e}rin, Eric and Paris, Axel and Peytavie, Adrien}, 35 |   Journal = {{Computer Graphics Forum}}, 36 |   Publisher = {{Wiley}}, 37 |   Year = {2020}, 38 |   Volume = {39}, 39 |   Number = {2}, 40 |   Pages = {545-554} 41 | } 42 | ``` 43 | -------------------------------------------------------------------------------- /Renders/render0.ppm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aparis69/Segment-Tracing/084b8268b798907316cbb44b6490cb2015c80374/Renders/render0.ppm -------------------------------------------------------------------------------- /Renders/render0_cost.ppm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aparis69/Segment-Tracing/084b8268b798907316cbb44b6490cb2015c80374/Renders/render0_cost.ppm -------------------------------------------------------------------------------- /Renders/render1.ppm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aparis69/Segment-Tracing/084b8268b798907316cbb44b6490cb2015c80374/Renders/render1.ppm -------------------------------------------------------------------------------- /Renders/render1_cost.ppm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aparis69/Segment-Tracing/084b8268b798907316cbb44b6490cb2015c80374/Renders/render1_cost.ppm -------------------------------------------------------------------------------- /Renders/render2.ppm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aparis69/Segment-Tracing/084b8268b798907316cbb44b6490cb2015c80374/Renders/render2.ppm -------------------------------------------------------------------------------- /Renders/render2_cost.ppm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aparis69/Segment-Tracing/084b8268b798907316cbb44b6490cb2015c80374/Renders/render2_cost.ppm -------------------------------------------------------------------------------- /Scenes/particles.txt: -------------------------------------------------------------------------------- 1 | 0 0 0 2 | 1.4972 -0.870447 1.00035 3 | -0.678975 -0.235919 -1.86637 4 | -0.642446 -1.41896 1.25452 5 | 0.280836 -2.60946 2.56991 6 | 2.97805 -2.15409 0.601161 7 | 3.22491 -0.208236 1.75962 8 | 4.23435 -3.69201 0.363462 9 | 1.5079 -4.04368 3.23121 10 | 4.09088 -3.98621 2.3365 11 | 4.00994 -5.67936 0.354238 12 | 6.05153 -4.37319 2.25834 13 | 1.16756 0.427568 -2.25378 14 | 2.354 -2.79602 4.54554 15 | 2.83396 0.638636 -1.16816 16 | -1.88384 1.31233 -2.25525 17 | 1.7952 -1.4692 -2.16238 18 | -0.204863 0.508224 -3.70634 19 | 1.5394 0.96829 1.78602 20 | 4.1567 -2.06498 4.08094 21 | 2.04444 -1.99256 6.35071 22 | 3.81902 -1.19558 5.88626 23 | -0.0202598 -0.0517756 -5.61745 24 | -0.818886 -3.89185 3.64046 25 | 2.28506 -6.68564 0.243814 26 | 3.97345 -1.29513 7.87781 27 | 8.00229 -4.73316 2.00345 28 | -1.44048 -5.29592 2.35897 29 | 1.18394 0.872891 -6.91933 30 | 9.13438 -6.19593 2.76415 31 | 2.31817 2.14243 0.366542 32 | 9.39686 -7.00268 4.5753 33 | -1.94788 0.450605 -5.79604 34 | -3.71834 1.1242 -1.48118 35 | 3.38595 -0.185353 9.43448 36 | 1.34394 1.23768 -8.87926 37 | 5.83849 -6.4892 0.33104 38 | 0.982805 -7.93441 -0.619143 39 | 1.66064 -5.47458 -1.22023 40 | 2.67316 -6.34949 -2.70662 41 | 1.51221 -0.505748 8.81283 42 | -1.60701 -2.66655 5.01068 43 | 1.95074 0.225476 -5.4218 44 | -2.61336 -1.33933 6.11781 45 | 1.67219 0.839017 9.31752 46 | 0.369467 -0.385108 -9.525 47 | 9.94709 -5.33287 5.52871 48 | 7.20094 -7.74782 -0.417032 49 | 2.95115 -4.61537 5.12294 50 | 0.725869 2.46948 9.98542 51 | 0.999648 0.551886 10.4311 52 | 1.25602 4.25492 10.7142 53 | -4.68398 0.296983 -3.02496 54 | 0.375565 -2.58259 7.28168 55 | -0.186623 -1.96145 -6.18794 56 | 1.40066 2.58225 -10.3588 57 | 2.21184 -8.29322 -2.802 58 | -1.40534 2.34675 -0.611775 59 | 0.956783 -6.17875 -2.9548 60 | 1.03701 -9.69512 -3.61099 61 | 0.780894 -11.1927 -4.91161 62 | 7.93015 -7.86176 -2.27587 63 | -6.49112 0.621166 -2.23175 64 | -0.323141 -12.8245 -5.25545 65 | -3.86242 -0.996372 4.59393 66 | -4.07947 -0.931984 -1.56749 67 | -5.42018 -2.03298 -0.572338 68 | -0.851234 0.329393 9.70668 69 | 7.74463 -9.28911 -3.66448 70 | -2.54521 3.50206 0.556961 71 | -0.441845 3.14002 -10.901 72 | -5.08575 -2.21755 5.60001 73 | -0.148357 2.71253 -8.96943 74 | 11.4151 -6.603 6.01001 75 | -4.30491 -0.922578 -4.5641 76 | 11.1448 -3.73127 5.54818 77 | -0.875924 1.19043 10.704 78 | -2.09643 2.36727 -8.67652 79 | 1.77593 -2.15385 9.91475 80 | 1.95549 -8.39427 -4.78293 81 | 11.5163 -7.97556 7.46116 82 | 9.54012 -8.82368 -2.97063 83 | 0.0752122 -13.3694 -7.13812 84 | -2.47398 0.417017 7.06429 85 | -1.96269 0.0499995 11.3458 86 | 10.5308 -8.64965 4.61544 87 | -0.5153 1.82001 -12.4018 88 | 0.810046 -3.59863 5.53145 89 | 3.20103 0.584177 -8.5269 90 | 9.76227 -10.5524 -3.95157 91 | -1.08848 -0.899377 -8.25617 92 | 1.87094 1.34876 -11.8612 93 | 2.86798 5.43765 10.7664 94 | 4.99065 0.0438371 10.606 95 | -1.41805 -0.742641 13.0994 96 | -2.18608 -12.3136 -4.73736 97 | -2.2548 4.97533 1.878 98 | 11.3035 -11.804 -4.19279 99 | -3.68079 3.17142 -7.75829 100 | 12.6893 -7.75998 4.9912 101 | 2.91612 -6.59045 5.43568 102 | -0.0915567 5.03716 -11.4284 103 | 12.1658 -7.45341 9.27928 104 | 3.14179 7.30317 11.4334 105 | -1.20642 -7.25948 2.65836 106 | 2.07616 -10.4104 -6.21936 107 | -7.33499 -0.572877 -3.59635 108 | 0.954507 -10.9174 -7.79569 109 | -3.0711 -0.514898 14.2019 110 | 3.80093 3.16986 -0.497063 111 | -0.57211 5.5724 -13.2946 112 | -8.76277 0.820853 -3.73406 113 | 0.666365 6.97523 -14.0005 114 | 4.73434 0.647433 -1.79146 115 | -4.64337 0.84035 4.72266 116 | 4.21665 7.43768 9.75214 117 | 2.00785 2.47275 8.21379 118 | -1.31882 -0.397843 15.0669 119 | -0.496526 0.773349 16.4641 120 | 11.5582 -1.84145 6.05581 121 | -2.90677 1.41041 10.2242 122 | 3.49454 8.94277 8.65065 123 | -1.71992 1.04557 -13.7979 124 | 2.02981 7.25008 -12.5633 125 | 1.80271 -12.7162 -4.11482 126 | -0.213944 -15.3281 -6.8554 127 | 10.8443 -9.44767 8.63645 128 | 10.3718 -13.0557 -5.44376 129 | 7.23871 -10.3321 -5.29425 130 | -10.6341 1.46932 -4.0127 131 | -12.1051 1.10029 -5.31647 132 | -3.14396 -12.9853 -6.35948 133 | 4.58755 -1.44663 11.8772 134 | 0.438151 -7.2624 3.79651 135 | 0.390309 5.28086 12.1968 136 | -5.79 -0.70695 6.70551 137 | 6.3081 -0.21501 12.0883 138 | 8.50151 -12.8079 -6.10761 139 | 3.00217 3.101 -11.4386 140 | -0.0405751 4.54564 -8.17691 141 | 4.09123 2.34628 -8.20671 142 | 2.89593 7.10722 13.4085 143 | -0.286979 -0.735836 17.7596 144 | 10.6451 -7.25208 10.5627 145 | 1.48378 -15.4398 -7.90672 146 | 9.28697 -6.46772 -1.81144 147 | -9.18271 2.67987 -4.34045 148 | 3.83916 5.41204 13.895 149 | -5.94094 -1.53771 -5.53622 150 | -4.08122 0.859933 15.2457 151 | -2.49278 2.01705 -15.366 152 | 12.5941 -0.89809 7.48303 153 | 11.2852 -7.87352 -2.74249 154 | 13.6332 -0.777816 5.77838 155 | -1.03108 5.16608 10.7945 156 | -0.666764 6.20728 13.6196 157 | -3.80941 -2.85723 7.00063 158 | -0.149158 1.43122 -14.3291 159 | -0.785644 0.762984 -10.6859 160 | 1.22169 0.897746 17.4801 161 | -1.37623 -15.4842 -8.4755 162 | 5.39065 8.56286 10.9165 163 | 8.07976 -13.8624 -7.75386 164 | 1.74291 -9.08344 -7.91813 165 | 1.54827 8.60386 -13.2456 166 | 2.04648 9.65667 -14.8715 167 | 3.45076 -1.09735 -5.42944 168 | -6.16899 2.12118 4.90143 169 | 7.08714 7.75953 11.6069 170 | 0.0632268 -17.2627 -6.43074 171 | 5.1591 0.26471 1.94733 172 | 8.96528 -9.8253 9.20809 173 | -4.50189 -14.2432 -7.1169 174 | 14.1822 -0.997215 3.86776 175 | 1.78857 1.8798 -14.1194 176 | 5.38384 8.77485 12.9052 177 | 8.2688 -11.5971 9.82104 178 | 9.26298 -5.84517 10.8948 179 | -6.94277 0.590108 7.69988 180 | 7.80865 -5.47065 12.2156 181 | 0.0750679 -17.7012 -4.47944 182 | -2.13262 4.5841 3.83556 183 | -7.47178 -0.945379 8.86711 184 | -0.966089 5.07422 15.2402 185 | 3.40716 -8.27511 -8.67765 186 | 0.523977 -2.33992 16.8826 187 | -9.61623 2.80699 -2.92891 188 | 2.37874 -16.0079 -9.60268 189 | -2.72231 -15.8841 -7.05137 190 | 3.21944 -2.52469 11.2484 191 | -3.69793 5.52206 4.65411 192 | -3.32713 5.83162 0.423051 193 | -8.41995 -0.735495 7.94627 194 | 8.8461 -7.82156 11.2254 195 | 14.078 -6.56151 4.19425 196 | 12.7725 -1.49285 9.3842 197 | -1.31823 -19.0771 -4.88656 198 | 11.9926 -11.4035 -6.0271 199 | 6.85792 -0.726407 13.942 200 | -6.14842 -15.2208 -6.53952 201 | 2.19654 -8.28 4.64345 202 | 12.4877 -9.48038 -6.26512 203 | 7.75017 -11.9044 11.728 204 | 1.86277 8.68276 -16.6086 205 | 0.180598 -9.2197 -8.51602 206 | -2.99543 7.34123 1.69232 207 | 3.19162 0.907286 -13.2968 208 | -13.9076 0.69032 -6.0801 209 | -10.4084 -0.855432 7.7686 210 | 12.9681 -8.05378 -3.80801 211 | 2.25576 -17.2544 -7.57338 212 | 16.0582 -6.6391 3.92484 213 | -2.87557 -18.0467 -4.17029 214 | -1.04017 4.8591 -15.1035 215 | -0.909778 -21.034 -4.82568 216 | 4.35672 0.336343 -11.7748 217 | -8.07011 -14.8776 -6.97467 218 | 7.91955 -5.63209 14.206 219 | 10.7649 -0.0946766 7.57613 220 | -1.7849 4.71346 17.0289 221 | 2.27198 -0.769866 17.8206 222 | 13.5763 -7.52091 -5.63724 223 | 14.6702 0.932299 5.7708 224 | -2.62595 3.49886 18.377 225 | 11.7806 -5.94213 -2.58678 226 | 11.8908 -11.404 -8.02451 227 | 11.5193 -7.51049 12.3429 228 | 8.3871 6.30712 11.159 229 | -5.87114 -13.0712 -7.98371 230 | -1.28454 7.53769 0.67533 231 | 1.35171 -18.7759 -6.20685 232 | -2.24777 2.0734 19.728 233 | 0.802295 -22.0392 -5.06722 234 | 8.86517 4.36898 11.2817 235 | -3.84069 1.65218 17.0662 236 | 1.90191 10.2544 -12.1729 237 | -0.124344 -3.52796 18.3551 238 | 2.24044 -14.5981 -11.0146 239 | 6.99556 -7.92874 11.9764 240 | 0.421889 -4.74798 16.8674 241 | 10.7695 -10.8076 -9.56954 242 | -14.7831 1.02723 -4.31376 243 | -2.58599 6.51403 5.98812 244 | 3.76023 4.53885 15.6926 245 | -13.0624 0.415609 -7.87182 246 | 3.88797 -9.07766 5.35255 247 | 11.0324 1.34982 8.93329 248 | -0.256883 -16.7444 -9.55205 249 | 11.237 -5.55985 12.0033 250 | 12.2051 -9.15305 13.2549 251 | 2.73223 -9.00863 6.98335 252 | 4.29444 1.14226 2.77563 253 | -9.24334 3.78765 -6.00452 254 | -15.6494 1.06891 -6.98723 255 | -8.13501 0.126551 10.4199 256 | 2.75032 -1.51833 19.6125 257 | -4.86017 -18.2929 -4.143 258 | 4.11402 10.1971 7.22135 259 | 0.217327 3.10007 -15.3687 260 | 4.68906 -1.97493 19.7936 261 | 12.1294 -10.6672 7.70849 262 | -2.41075 6.2875 -14.8186 263 | -7.14794 -14.4842 -8.70522 264 | -3.19614 3.19739 -16.8193 265 | -4.72226 -3.39245 8.69776 266 | 13.2757 -6.7188 12.8796 267 | 15.3443 -7.757 -6.54191 268 | 14.6272 -7.8216 4.50086 269 | 16.024 0.905172 4.29884 270 | 3.75342 10.293 10.1032 271 | -5.1809 -4.55591 10.2585 272 | 5.00608 -2.90647 21.5348 273 | 4.97318 0.384995 -14.0406 274 | 3.10758 -0.945478 -12.5483 275 | 12.5225 -9.12679 -1.7947 276 | 0.0118022 -7.55953 -9.61844 277 | 14.0319 -0.151187 8.65561 278 | -5.60052 -16.6347 -7.84355 279 | -17.1502 2.39087 -6.98543 280 | 5.70335 4.78976 15.291 281 | 3.18647 -16.6375 -11.3206 282 | 5.77461 10.6925 12.4932 283 | -18.3472 2.14325 -5.40243 284 | -6.75971 -17.7707 -4.48801 285 | 4.05281 4.68503 17.6657 286 | -12.8814 2.67836 -4.36407 287 | 6.60123 8.90572 9.36182 288 | 12.8989 -9.35389 11.3899 289 | -18.1731 3.23075 -3.73298 290 | -4.95972 7.61547 1.43472 291 | 1.55414 -20.7496 -3.7362 292 | 6.50629 11.1598 10.6915 293 | 15.012 -5.99616 13.5601 294 | 0.145803 -21.1609 -6.73983 295 | 2.21153 11.6383 -10.7626 296 | 6.42077 11.9758 8.86751 297 | -5.61115 -14.656 -9.97359 298 | -2.00203 6.54918 16.107 299 | -8.12952 -0.521384 -2.33282 300 | -5.1235 -6.51082 9.84015 301 | 6.93674 -11.9095 -6.48625 302 | -0.962879 7.15905 10.6415 303 | -4.53151 -16.3898 -9.51604 304 | 4.58286 -2.99158 23.4877 305 | 11.4155 -12.5353 7.73046 306 | -0.280359 -23.0456 -3.72002 307 | -4.45416 -2.62236 -6.31918 308 | 1.23549 10.8064 -16.2929 309 | -6.38522 -18.2059 -8.80048 310 | -0.111664 8.36401 -16.6129 311 | -1.97077 8.79464 11.1974 312 | 3.8918 -1.45497 24.5653 313 | -7.07489 -19.1405 -5.91079 314 | 3.33863 -2.92667 25.8015 315 | -1.85018 9.25361 -16.1814 316 | 6.40689 -12.7908 12.9154 317 | -7.74565 -19.9305 -4.2002 318 | 1.87441 -3.15557 12.5874 319 | 3.61104 -4.82667 26.3634 320 | 2.64771 13.2677 -9.68798 321 | 11.3901 -14.3119 -4.26682 322 | 2.40965 14.6215 -8.23519 323 | -2.074 10.9961 -15.2255 324 | 1.44025 5.87338 -8.38736 325 | 3.68797 -0.386999 26.244 326 | -4.97627 3.67914 -16.0453 327 | 4.45799 12.1854 12.2989 328 | 3.48035 10.0923 -10.7534 329 | 16.8175 -9.04525 -6.95433 330 | 2.28718 -1.47742 27.1652 331 | -10.6096 4.45382 -2.38016 332 | 17.7091 -7.46735 -6.10854 333 | 17.9628 -6.27096 3.43783 334 | 15.3949 -10.4237 -7.22987 335 | -4.39701 -20.1643 -3.61069 336 | 17.4819 -4.3495 3.16085 337 | -6.97732 -19.7575 -9.9149 338 | 2.42124 15.4422 -10.059 339 | 7.79129 -0.205262 15.6323 340 | -8.60969 1.13322 -5.70357 341 | -7.60398 -2.69486 9.82723 342 | -3.33174 5.80994 -16.5285 343 | -8.06721 -21.3836 -10.3246 344 | 14.2622 -9.87121 12.7587 345 | 5.22561 -5.99895 26.2259 346 | -14.8452 2.83439 -5.16836 347 | 6.3537 12.0489 13.8442 348 | 5.47184 -13.9464 14.2535 349 | 19.0338 -7.85252 -4.66048 350 | 13.8516 2.31446 6.96218 351 | 12.5297 -5.88209 -6.1051 352 | 5.97557 2.08285 -13.7052 353 | 4.01195 -4.48028 22.2661 354 | -9.44746 -13.5145 -7.4694 355 | 0.588399 -6.37935 18.0123 356 | 2.56575 10.5561 -17.7653 357 | -0.0396475 -18.2056 -2.54748 358 | 15.2098 -10.1326 14.5005 359 | -19.9964 3.26371 -5.24527 360 | 2.42985 6.84141 -16.0721 361 | -7.30584 -21.7114 -3.40337 362 | 0.973784 -8.09755 17.064 363 | -20.8115 2.80202 -7.01227 364 | 5.18098 -1.0345 21.4888 365 | -9.65927 4.97242 -7.56123 366 | 13.3579 -5.59989 14.5353 367 | -3.42394 -5.52846 2.46762 368 | 16.5033 -6.89374 12.5751 369 | -20.4391 2.507 -8.95502 370 | 3.50218 -5.46891 23.9283 371 | -1.34011 7.53564 4.80318 372 | -6.40423 -12.1528 -9.67853 373 | 1.76438 12.1471 -14.9063 374 | 15.5587 -1.31631 5.82927 375 | -20.1331 1.9955 -4.5144 376 | -20.0902 4.19327 -9.97223 377 | 3.68607 11.6963 14.0779 378 | 0.498845 -11.5343 -9.64279 379 | 7.80628 -13.5174 10.1346 380 | -11.2976 -0.519324 -4.46515 381 | 2.47606 15.3623 -6.37866 382 | 7.10099 4.72618 16.7201 383 | 10.2594 -15.3513 -5.5479 384 | 5.4128 8.84532 6.52433 385 | 15.5599 -0.681871 9.83186 386 | -9.23426 -21.9704 -3.86612 387 | -19.1649 2.57982 -2.12277 388 | -2.7273 12.7077 -14.4233 389 | 0.489739 -9.33766 15.5714 390 | 6.03728 -7.77806 26.6454 391 | 3.57878 16.9761 -10.6133 392 | -18.3124 2.31712 -0.332701 393 | 6.25588 -13.7946 16.0871 394 | -3.77923 4.028 19.923 395 | 6.16392 1.99258 1.878 396 | 5.21441 -7.58987 5.51694 397 | 9.90985 -9.08899 -9.01526 398 | -21.3035 4.71029 -5.69124 399 | -8.13996 -1.0158 -5.37282 400 | 0.756021 -1.46517 28.4519 401 | 14.0382 3.81757 8.26826 402 | 1.27804 -12.3432 -11.2977 403 | -4.48381 2.8008 14.9793 404 | -7.98093 -18.7277 -9.88741 405 | 3.85861 11.9857 -18.2989 406 | -2.05384 9.37357 5.13868 407 | -5.85158 -7.08784 11.6113 408 | -5.34965 -11.594 -11.2834 409 | 7.42825 13.0387 12.4783 410 | -6.08297 -23.2471 -3.02135 411 | 0.928068 12.4332 -17.4149 412 | 6.1982 -3.30388 19.9789 413 | 2.29145 17.3348 -9.42546 414 | 12.8915 -12.3641 6.39178 415 | 3.31741 13.4011 13.4039 416 | 6.30407 8.68491 4.7411 417 | 19.9254 -5.91348 3.29529 418 | -8.34044 -23.7265 -4.20822 419 | -19.4794 4.54663 -2.30375 420 | 4.941 16.7888 -12.0656 421 | 0.115207 -13.6981 -12.1988 422 | -5.28918 -18.7654 -6.72963 423 | 2.08257 -14.1008 -12.9453 424 | 2.37232 11.4601 10.9579 425 | 5.20225 8.70502 3.07209 426 | -9.56092 -23.6829 -5.79205 427 | 1.8202 6.87835 -17.9766 428 | -8.47161 -20.2991 -11.1289 429 | -18.6169 0.340525 -0.351926 430 | 0.943212 -1.93545 30.3868 431 | 16.2891 -0.403721 11.6733 432 | 12.7795 5.14599 9.07521 433 | -4.28404 13.9304 -14.1379 434 | 15.5128 4.46579 9.45372 435 | -0.495126 -23.4125 -1.76571 436 | 4.61244 15.4909 -13.5514 437 | 0.799907 -3.90369 30.7115 438 | -10.6111 -23.4826 -7.48235 439 | -20.8807 1.72917 -1.54615 440 | 2.48585 -2.84639 -12.5476 441 | 2.19146 -4.7468 -13.097 442 | -19.7502 5.51835 -0.576793 443 | -3.6279 15.7016 -14.7954 444 | -0.716206 -24.6067 -0.176752 445 | 2.56797 -20.0956 -2.14106 446 | -3.20743 10.2856 10.6998 447 | 4.37569 4.41648 19.6211 448 | 6.86182 16.9076 -12.61 449 | 1.49991 8.79774 8.63006 450 | 4.8661 9.34044 -11.984 451 | -1.73514 0.292062 -16.0371 452 | -0.639525 6.51279 -17.1554 453 | 3.80579 14.9649 14.5512 454 | -8.60592 -21.4533 -12.7567 455 | 2.08772 2.67933 17.2045 456 | 8.52 -2.05787 15.8242 457 | 0.275603 -2.85038 32.3288 458 | -6.48121 -10.3704 -12.3889 459 | 2.43985 10.6001 -19.7608 460 | 5.49883 16.5146 -10.2964 461 | 0.415781 -4.33973 32.6252 462 | -20.8254 1.94528 -10.8353 463 | 4.87886 18.6186 -12.8707 464 | 3.8111 -5.71542 -13.7592 465 | 4.1877 -6.80258 22.6049 466 | 1.74121 12.238 -12.3715 467 | -19.982 2.41063 -12.588 468 | 16.4492 -12.0618 -6.77728 469 | -7.18593 -21.7314 -5.39967 470 | -5.33514 5.01414 -17.4906 471 | 6.38645 12.7909 7.04145 472 | -17.7882 -0.383882 1.31795 473 | 13.466 -10.3874 15.446 474 | -4.16371 -20.3717 -7.12073 475 | 2.20913 10.2901 -21.7231 476 | -4.75982 15.4737 -16.4285 477 | 0.235615 -3.89348 34.5665 478 | 7.5856 -15.495 10.3356 479 | -1.65943 10.7547 10.9496 480 | 17.0641 -10.2499 13.7602 481 | -2.83121 0.148215 9.01368 482 | -20.2447 5.88554 1.32602 483 | -7.21566 5.50931 -17.958 484 | 0.529225 -14.4565 -14.0025 485 | -0.101289 -10.9754 16.5556 486 | -16.9267 -0.445825 -6.71525 487 | -16.9016 2.75915 -1.67962 488 | 1.72059 -5.1476 25.7949 489 | 1.75725 19.2175 -9.83778 490 | 6.04736 2.23128 -7.80628 491 | -5.18124 6.86358 4.64432 492 | -5.7585 13.4306 -12.8825 493 | 17.2034 4.43415 10.5219 494 | 19.3042 -9.40566 -3.42979 495 | 20.804 -7.61476 3.87292 496 | 6.85775 17.7042 -9.43737 497 | -1.61803 -4.85656 18.4162 498 | 1.25373 -15.0364 -15.7742 499 | 12.5699 -14.0266 5.32751 500 | 4.91576 13.6634 -18.0386 501 | 2.68521 -22.5943 -5.4499 502 | 12.6419 -15.9022 6.0181 503 | 17.9881 -2.54966 3.87101 504 | -4.20063 4.51112 21.8174 505 | -16.6365 -0.787091 -8.66443 506 | -3.36324 6.22782 22.4105 507 | -5.70606 -8.40586 10.1037 508 | -16.4667 4.25498 -6.74467 509 | 12.0604 -10.5303 16.8616 510 | -19.707 0.661521 -8.71384 511 | 1.48482 17.0339 -5.90618 512 | 4.39108 -21.5591 -5.58546 513 | 1.96751 14.7873 13.9103 514 | -21.4089 -0.374581 -8.88734 515 | 7.01031 -5.11196 26.3936 516 | -7.39186 0.539326 4.85327 517 | -9.60486 -22.9634 -13.6062 518 | -2.26692 -0.988546 -17.4784 519 | -2.7181 7.60176 23.7129 520 | -11.0357 -23.4654 -9.43666 521 | -9.93933 -18.9288 -9.53493 522 | 4.77227 0.0959422 27.8536 523 | 8.81889 3.70753 16.6144 524 | -14.5815 1.70203 -8.06597 525 | 17.7695 -13.5123 -6.38621 526 | 10.7565 3.32816 16.9336 527 | 3.64093 20.0543 -12.2334 528 | 3.47427 21.402 -13.7016 529 | 5.38914 9.83659 -13.8495 530 | -5.33983 17.2684 -15.7633 531 | 16.614 -14.472 -7.70665 532 | 0.286326 10.6981 -21.3539 533 | -1.14823 7.54886 -13.3855 534 | -18.9984 5.04098 -11.4177 535 | -22.5976 1.90512 -7.08658 536 | -21.0915 6.51195 -4.84916 537 | 0.0299078 -22.6889 -8.02509 538 | 3.42104 -5.3023 28.2967 539 | 2.9118 -5.27689 -15.491 540 | 15.3172 -0.116748 13.3976 541 | 21.1346 -8.8366 -2.85908 542 | 7.75383 18.2563 -11.433 543 | 17.4853 -5.47997 -6.09288 544 | 4.01447 10.9819 -22.2351 545 | 20.828 -6.97543 -4.55408 546 | 1.23743 15.3445 -11.668 547 | -16.5559 5.04704 -8.57897 548 | 8.69419 16.3736 -12.0123 549 | -22.982 -0.0234911 -6.72222 550 | 7.53898 15.9399 -8.78684 551 | 2.81335 -5.10066 -11.2293 552 | 1.64675 18.2756 -4.34672 553 | 1.85761 20.2616 -4.23893 554 | 0.222647 -8.00378 19.1203 555 | -23.0619 6.57873 -5.18561 556 | 4.63897 -7.53603 -13.7545 557 | -23.2803 4.77037 -5.39374 558 | -8.31373 -2.20224 7.55889 559 | 17.513 -11.0719 11.9931 560 | 11.691 -12.3753 -9.76134 561 | -24.8492 -0.335514 -7.36724 562 | 23.0762 -8.41863 -2.62301 563 | -6.91984 -1.81663 11.4888 564 | 0.512004 -3.30832 36.4589 565 | -19.5356 7.08739 2.75879 566 | -5.78268 -10.4023 10.1944 567 | 12.5992 -10.2289 18.764 568 | -5.24498 2.87051 22.2841 569 | -26.6587 -1.10072 -6.9927 570 | 6.63807 0.0867643 -15.1079 571 | -8.08084 -2.46584 -2.79834 572 | -2.85196 16.3225 -13.0598 573 | 16.1348 -12.0593 -8.7524 574 | 4.1568 -8.43077 26.451 575 | -0.00299441 -2.45985 38.1952 576 | -7.19962 -9.42522 -10.7794 577 | -4.34427 16.5741 -11.7522 578 | 18.8546 -9.69378 11.4446 579 | -1.14787 9.31158 -21.4973 580 | 11.8995 1.89631 6.84102 581 | 2.58397 20.1774 -8.29012 582 | -4.84705 18.2342 -10.7566 583 | 4.8579 16.4648 15.3532 584 | 22.6859 -6.36867 -4.97868 585 | -9.14102 -3.95622 9.61164 586 | 7.50291 19.5355 -9.91712 587 | -23.5261 4.78239 -7.37853 588 | 0.111119 15.3525 14.3944 589 | -4.61844 3.62269 24.0281 590 | 4.27475 15.0566 -19.3223 591 | -0.664677 -1.69174 36.5046 592 | 3.82429 18.0831 14.7937 593 | -9.35513 -3.83866 -3.49945 594 | 5.3805 -9.59081 27.177 595 | -25.618 0.936077 -8.70591 596 | -6.10556 -24.4105 -4.64802 597 | 11.3467 -12.4886 -11.7282 598 | 7.81395 14.5894 -11.8078 599 | 7.74562 -13.6343 14.7624 600 | 9.98932 16.31 -10.4896 601 | -27.7357 -1.72998 -5.42938 602 | 1.64032 -9.77117 3.43223 603 | -24.5891 5.29733 -5.34592 604 | -11.6696 -24.4427 -11.0624 605 | 1.79836 22.0059 -3.26233 606 | -13.5909 -1.49087 -7.57841 607 | 7.25471 -5.84211 28.2394 608 | 0.756989 -23.8293 -9.49841 609 | 12.8325 -8.29044 18.3306 610 | -0.94652 12.0283 -17.9823 611 | 5.40557 -14.3241 17.8182 612 | -4.93302 -18.2956 -9.97045 613 | 5.01677 -10.1567 6.60211 614 | -27.9746 -2.91096 -7.02571 615 | 7.67749 14.3151 7.14117 616 | -10.4091 -20.0773 -11.5728 617 | 4.47391 22.912 -14.5506 618 | 20.4804 -7.76844 -6.35693 619 | -8.39181 -9.7872 -12.2915 620 | 3.47996 -14.061 14.1147 621 | 4.38032 -8.89074 28.7611 622 | 5.17764 0.866771 20.8682 623 | -0.700692 16.0525 12.7059 624 | 4.56972 -10.671 25.7019 625 | 7.36087 -14.2134 8.31324 626 | -0.961486 7.59326 -22.5036 627 | 13.3679 6.25597 10.6314 628 | 4.23866 -19.0085 -1.97675 629 | 17.6574 -12.3904 -10.0062 630 | 14.5424 -14.2654 5.09899 631 | 2.9428 -8.8295 30.1503 632 | 2.18916 -15.9851 -17.2658 633 | 5.26169 8.18492 1.14181 634 | 0.681415 7.70764 -8.63161 635 | 12.9305 -12.6511 -12.9387 636 | -1.85884 7.69121 -24.2883 637 | 16.946 3.80559 8.22493 638 | 11.3353 -14.4689 -12.0084 639 | -11.4964 -26.3977 -10.6775 640 | -1.28717 8.03684 22.385 641 | -7.77344 4.24001 -19.3994 642 | 7.51849 -8.17157 27.9304 643 | -1.89533 5.88799 -25.1526 644 | -10.3177 -5.32495 10.4731 645 | 4.02299 -11.4002 23.9216 646 | 4.66443 -20.4084 -7.19821 647 | 5.23761 10.6258 -23.7769 648 | 18.6575 -11.0077 -8.96326 649 | 15.3722 1.12497 2.42083 650 | 16.0693 5.76425 11.4938 651 | -4.09719 14.5695 -18.0847 652 | -21.4195 8.43353 -5.29634 653 | -8.8227 0.880076 9.0543 654 | 8.29194 11.6397 14.1196 655 | -21.7088 5.77253 2.68375 656 | 0.548632 -11.3937 3.01326 657 | -6.29773 -13.456 -11.4187 658 | 9.78436 5.77838 12.4887 659 | -10.4337 -27.9965 -10.1168 660 | 2.94339 15.2634 12.2307 661 | -10.8893 -4.01773 -4.76996 662 | -12.3328 -27.5745 -12.0615 663 | 7.04565 11.3224 -24.2727 664 | -8.25755 -16.5498 -3.97234 665 | 11.1362 5.02664 15.9482 666 | 5.68326 -21.5616 -8.47575 667 | 3.88973 -14.3252 15.4168 668 | 9.34048 -16.4315 10.1273 669 | 21.9442 -10.157 -1.59368 670 | -5.17584 10.2467 10.3479 671 | -5.70384 17.2906 -17.7298 672 | 2.71074 -15.8933 -19.1944 673 | -10.9327 -21.0413 -3.36405 674 | 7.49162 -9.08463 26.2237 675 | -18.3669 8.69095 2.50867 676 | -1.55921 -2.05785 32.4019 677 | -8.97367 -12.9688 -9.33425 678 | -18.3956 10.3211 1.35031 679 | 7.37251 2.22479 -6.30831 680 | 16.0225 -16.3358 -7.28661 681 | 7.50636 9.41594 -24.6641 682 | -6.13397 11.11 8.81927 683 | -3.52263 18.0815 -15.5718 684 | 10.18 11.2313 14.6376 685 | 3.59643 -10.4908 31.0518 686 | -9.1034 5.87188 -18.5103 687 | 21.0727 -9.45448 -7.25493 688 | 19.8703 -12.5499 -9.35179 689 | 1.08722 -16.2577 -14.6691 690 | 11.665 -8.34725 19.9535 691 | 8.15447 -14.4082 15.95 692 | -10.6122 -14.608 -6.26622 693 | -2.59812 2.54997 -18.6146 694 | 0.0304231 20.0416 -3.45599 695 | 10.5925 -16.0825 -11.0895 696 | -19.4613 6.82712 -12.1894 697 | -19.7695 7.82648 4.60244 698 | 9.54199 -13.6164 -12.248 699 | 17.8306 -12.9973 12.4312 700 | -28.0442 -3.55021 -4.66021 701 | -24.4981 6.45677 -7.88018 702 | 1.82127 -11.0937 31.7485 703 | 8.61126 21.1982 -10.0018 704 | -3.3108 -6.03318 9.14303 705 | 5.22648 13.7699 -20.5217 706 | -5.27407 4.26942 -8.26412 707 | -6.33007 3.05412 24.8924 708 | 7.87728 -0.170509 -16.6565 709 | -18.0728 0.587941 3.04264 710 | -5.70257 17.6827 -12.7145 711 | -16.3836 8.74374 2.25573 712 | -5.61024 0.914636 17.6361 713 | 18.0753 6.00371 9.6408 714 | 14.0842 -14.2743 -12.7543 715 | -0.144337 -11.4628 31.7615 716 | 17.005 -1.05495 13.9182 717 | 1.78123 -15.2128 -20.8293 718 | 12.804 -15.3093 7.92129 719 | -5.25284 4.76445 18.7889 720 | 23.1487 -11.6 -2.27685 721 | 15.3658 7.52486 12.1305 722 | 6.28822 -12.8481 18.8392 723 | -12.2581 -22.5345 -3.24738 724 | 23.8299 -10.1494 -3.28342 725 | 10.5341 -17.9836 10.5354 726 | 0.340138 -4.08819 39.3046 727 | 4.06371 -16.8651 -6.81196 728 | 12.1636 4.62439 17.5165 729 | -27.0358 1.38438 -7.36844 730 | -10.6572 -22.2987 -15.1717 731 | -14.3118 -27.5637 -12.3501 732 | -29.3722 -4.2715 -6.58346 733 | -9.2106 -6.94918 10.8422 734 | 6.15004 15.5972 7.29367 735 | 10.482 20.6534 -10.453 736 | -8.05644 4.06156 24.8238 737 | -21.659 5.20544 -1.08556 738 | 21.6582 -8.49329 -8.90818 739 | 19.7996 -7.78691 -9.124 740 | 25.6799 -10.9055 -3.20543 741 | 13.8222 -10.8674 20.2119 742 | 22.3407 -6.61982 -9.06429 743 | 22.0871 -10.5458 0.362943 744 | 2.72389 10.5912 15.4391 745 | 26.3678 -12.1969 -4.56886 746 | -13.5592 4.32936 -3.46137 747 | 7.0481 1.31646 20.3213 748 | 12.7827 -15.492 -13.6618 749 | 8.19273 19.2363 -8.06385 750 | -27.1921 2.04966 -9.23688 751 | -19.6032 11.8588 1.77121 752 | -1.1364 16.0411 15.7978 753 | -1.54824 -11.0027 33.1096 754 | 4.4546 -8.7014 31.4534 755 | -8.08744 6.62445 -20.0599 756 | 12.4079 6.4797 18.2223 757 | 4.26272 14.2859 -22.1965 758 | 27.6048 -11.3054 -2.83838 759 | 8.79907 15.8626 6.55176 760 | -5.86282 13.6306 -18.1176 761 | 2.91133 7.02642 -7.67574 762 | 9.66473 22.2496 -8.66586 763 | 15.4754 -14.3795 -14.1873 764 | 13.4884 -17.1137 8.44654 765 | -14.0034 -22.3433 -4.20513 766 | -2.23157 5.45587 -27.0762 767 | 11.2014 3.15182 18.8755 768 | -6.50621 18.7537 -16.4218 769 | -23.3026 4.78042 1.99408 770 | 13.2409 -18.6238 9.7343 771 | -24.3176 7.98527 -9.15734 772 | 20.0226 -10.499 12.8545 773 | -2.52292 9.77229 8.89204 774 | 9.12363 14.7318 -8.61543 775 | 0.525337 -12.6215 33.2477 776 | 12.3435 20.117 -9.95588 777 | -14.8204 -21.4677 -5.80699 778 | 20.842 -10.8452 1.89921 779 | -8.23932 5.86414 -21.9036 780 | 27.7543 -11.1205 -0.852558 781 | -6.48071 19.2633 -18.3556 782 | 11.4296 22.352 -10.9187 783 | -1.9528 19.8063 -3.56316 784 | -18.0213 7.86931 -13.1061 785 | -25.1983 9.77788 -9.05262 786 | 1.97398 -2.18136 38.3137 787 | 3.76652 -19.6937 -0.158067 788 | 9.62182 -0.792354 -15.9016 789 | 8.05869 -5.3044 -2.87821 790 | 9.6741 12.0886 16.3723 791 | -1.16035 11.4234 -22.5291 792 | -1.22639 -0.0873625 32.482 793 | -4.33442 -22.4016 -2.5443 794 | 6.8001 -5.81057 30.1868 795 | 13.0468 -7.83986 21.3074 796 | -19.0257 4.90802 2.57439 797 | -1.41323 15.7138 10.8681 798 | -3.01561 19.9995 -15.8256 799 | -28.3796 2.88431 -10.6129 800 | -0.287159 0.413147 34.1753 801 | 7.58253 -0.0134591 -18.6285 802 | -16.726 9.94658 0.314901 803 | 4.05566 -15.2667 -17.2687 804 | -26.1617 10.3554 -7.39787 805 | 8.82546 8.34046 -25.7145 806 | 8.85597 6.44886 -25.0657 807 | 21.4003 -12.3026 -8.08778 808 | 1.07621 -8.22354 29.7647 809 | 4.84484 -11.5109 19.1977 810 | -27.3457 1.45326 -11.5527 811 | 13.5957 2.28601 4.76438 812 | -8.52535 5.81804 25.6574 813 | 3.48551 -14.2682 -21.2801 814 | -12.4586 -29.541 -12.4038 815 | 8.50283 8.03805 -27.665 816 | 2.28449 -7.85939 31.7706 817 | -2.13134 5.12238 -29.0457 818 | 1.97357 -13.2263 -20.959 819 | 21.5069 -6.82868 -10.0064 820 | -0.485118 4.05735 -29.4402 821 | -2.29576 21.8466 -16.0902 822 | -16.572 7.13353 -14.2714 823 | 24.052 -5.21021 -5.86837 824 | -3.77437 -1.73369 15.6231 825 | -17.1643 5.24714 -14.5726 826 | -8.5853 1.05964 -1.19588 827 | 20.6398 -9.53483 14.4944 828 | 8.48359 -18.2386 10.1112 829 | -21.5002 11.2459 1.93171 830 | -3.34788 8.53238 -15.0693 831 | 14.2094 20.4388 -10.5999 832 | -9.92043 -29.8919 -9.73716 833 | -0.139982 -15.4282 -21.3417 834 | 14.1016 -5.13154 -5.12236 835 | 9.56031 7.88087 -29.3553 836 | 22.9387 -10.7887 2.15618 837 | 3.33147 -12.2134 25.9986 838 | 1.43893 -14.2321 34.0035 839 | 4.45914 24.0264 -12.8899 840 | -22.3926 9.97539 -4.47433 841 | 4.6615 10.2216 -25.649 842 | 5.08474 -15.4677 -21.2201 843 | -6.76962 21.1373 -18.9918 844 | 4.48531 -23.2048 -4.82782 845 | 1.16429 15.617 -4.53155 846 | 8.22337 -3.62112 25.8405 847 | -0.499325 -15.6798 -23.293 848 | -16.6268 -22.3058 -5.99259 849 | 3.30981 -13.5944 33.6983 850 | 17.2203 7.46608 8.57757 851 | -3.45357 6.04956 -28.5439 852 | 13.3203 -13.9286 -3.91002 853 | -11.8334 -30.3537 -10.094 854 | 22.5082 -13.9648 -7.98902 855 | 1.97909 -9.14581 33.2712 856 | 13.3888 -7.74699 23.2757 857 | 4.3487 -12.6865 22.4252 858 | -2.83385 18.7608 -17.3853 859 | -6.79493 -0.653422 18.0072 860 | -18.4191 -23.0157 -5.45972 861 | -9.90881 -29.4531 -11.6884 862 | -20.0812 -23.5194 -6.45144 863 | 4.68941 -11.5639 5.21907 864 | 15.0046 9.23203 13.1078 865 | 4.38211 14.9252 7.94394 866 | 18.301 -5.12573 -4.30145 867 | -21.7652 7.02936 -1.8992 868 | 5.06998 -4.66565 -12.6133 869 | 11.6173 6.21683 13.1581 870 | -17.0158 9.5644 -13.4461 871 | -22.2211 12.2874 0.383936 872 | 2.77951 -1.40505 30.9756 873 | -26.6362 11.5268 -5.84782 874 | -5.12972 6.3807 23.3358 875 | 16.3339 -1.24375 15.7927 876 | -2.60679 -9.89334 34.3937 877 | 12.0284 -17.4088 4.85452 878 | -18.211 12.3055 1.18238 879 | 7.74469 -19.8548 9.1937 880 | 7.83481 -19.4042 11.6013 881 | 9.33644 6.16132 -26.9858 882 | 8.57744 13.0692 15.489 883 | -15.5861 -22.0264 -3.02417 884 | 10.7379 6.37844 19.3181 885 | -13.5585 -29.8571 -14.044 886 | 16.4504 7.58656 6.73563 887 | -23.3253 10.3499 -9.45826 888 | 2.81227 0.5891 31.1248 889 | -20.2118 13.714 1.33783 890 | 14.7432 -11.9567 -12.4574 891 | 25.908 -5.28086 -5.12657 892 | 20.2335 -12.284 11.9774 893 | -1.64798 -8.82943 35.7897 894 | -28.1111 10.6068 -7.76794 895 | -0.386178 -5.95164 39.299 896 | -13.2918 -29.1252 -15.8861 897 | -18.5768 13.4939 -0.384058 898 | -6.61469 19.4489 -12.9351 899 | 4.86243 -12.7586 32.7545 900 | 9.04327 12.7796 18.1399 901 | 17.1969 -3.53011 5.42432 902 | 6.22347 -8.35048 30.5885 903 | 13.3429 -12.7313 19.668 904 | 4.75347 -16.9543 -18.0841 905 | -27.0754 -3.3027 -8.76869 906 | -1.36407 21.6857 -3.21499 907 | -23.2886 9.50427 -11.2703 908 | 0.28279 -9.09384 36.2393 909 | 2.64812 19.6235 15.2874 910 | -21.0941 -25.2436 -6.41667 911 | -28.5129 1.18814 -13.155 912 | 9.46355 7.65364 -31.34 913 | -2.53696 7.76059 -29.0258 914 | 7.92683 15.9003 4.75238 915 | -6.43817 -25.8416 -6.00503 916 | -2.62999 21.4464 -4.48592 917 | 1.07325 20.6112 -7.05337 918 | -12.582 -31.4463 -12.9993 919 | 3.71988 -14.3568 -23.2643 920 | 5.79282 1.69304 28.4922 921 | 1.60934 7.38637 -19.8994 922 | 10.5058 13.431 15.145 923 | 3.54879 -13.1036 35.6223 924 | -8.17264 18.5789 -12.0318 925 | -20.7444 9.29005 3.64982 926 | 21.2068 -10.6419 16.0606 927 | 15.3044 -7.28044 22.9401 928 | 8.491 5.15467 -28.493 929 | -1.71091 -6.12562 37.8108 930 | -1.41049 -16.1096 -19.9555 931 | -29.6718 3.76899 -11.8569 932 | 11.1227 7.60479 -32.4557 933 | 6.66929 2.96121 29.7664 934 | 15.4885 1.43146 0.447878 935 | 19.4124 -12.1458 -11.2563 936 | 1.79904 -8.55955 37.4291 937 | 4.75412 -13.693 -18.2866 938 | 17.4791 -16.303 -5.91652 939 | -0.732474 -5.76009 31.8103 940 | 15.8371 -17.891 -6.04282 941 | 27.7016 -9.45477 0.253079 942 | -30.7486 -5.15579 -5.43304 943 | 1.96917 -3.63094 40.371 944 | 20.4521 -6.20388 5.24608 945 | -28.0294 -4.97182 -9.31987 946 | 1.03776 2.95706 -28.7545 947 | -17.7613 11.0285 -1.01086 948 | 15.7833 21.6538 -10.8161 949 | 23.5853 -6.96264 -10.5918 950 | 4.68988 -12.9143 -22.1265 951 | 8.54636 21.3723 -7.2589 952 | -14.6199 -22.2396 -7.64113 953 | 16.8975 -14.7645 12.5084 954 | -27.5771 -6.79113 -8.62309 955 | 7.93572 3.04528 31.312 956 | -10.1629 6.1053 -21.4119 957 | 8.83143 2.48623 33.0106 958 | 11.202 23.9592 -12.0872 959 | 9.46359 -8.33693 28.3654 960 | 12.436 -10.6939 21.6431 961 | 23.0434 -11.4335 16.0503 962 | -11.0256 7.17969 -22.8614 963 | -11.4445 -29.8775 -16.0325 964 | -2.46123 -15.9321 -23.5884 965 | -2.08175 -12.9299 33.1429 966 | -30.0665 -6.95686 -4.89374 967 | -14.215 -25.8992 -11.2455 968 | -27.7495 -5.49776 -5.00687 969 | -27.9665 -7.46817 -10.4643 970 | 19.1564 -14.2344 13.275 971 | 6.30651 -11.2143 27.889 972 | -3.24934 -2.52525 33.3637 973 | 8.24795 2.11179 34.8866 974 | -3.48411 20.0612 -2.30216 975 | -31.4484 -8.40218 -4.93109 976 | -21.4542 12.5283 3.46576 977 | 7.46041 3.72176 28.0943 978 | -8.46895 2.66602 26.1958 979 | 6.62833 21.6742 -6.77934 980 | 2.9477 -3.19504 42.0599 981 | -23.2379 11.9147 -1.2975 982 | -3.77126 -1.37529 34.9145 983 | 5.42727 -19.6589 -8.88832 984 | 6.52338 -18.1903 9.71714 985 | 1.3687 -17.1372 -20.0016 986 | -1.50891 12.9361 -23.7902 987 | -9.18966 -11.169 -8.48928 988 | 7.88418 4.77112 -25.5565 989 | 5.79835 -14.3718 32.0323 990 | -6.05915 11.5725 -13.5585 991 | 2.98571 -20.8443 -0.334144 992 | -7.41737 18.4813 -19.9403 993 | 9.58952 2.635 36.2746 994 | 2.27336 -15.4556 35.3477 995 | -25.1603 11.3869 -1.13721 996 | 3.98781 20.9875 15.8745 997 | -17.5632 11.0087 -12.1755 998 | 2.84052 15.9003 -3.478 999 | 16.5782 19.8235 -10.681 1000 | -3.11759 -9.33587 37.0481 1001 | 2.24769 -8.60406 39.3776 -------------------------------------------------------------------------------- /VS2017/SegmentTracing-EG2020.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | Debug 14 | x64 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 15.0 36 | {B3831FC6-FED7-4E0E-A51F-9D1C542F616E} 37 | SegmentTracingEG2020 38 | 10.0.18362.0 39 | 40 | 41 | 42 | Application 43 | true 44 | v142 45 | MultiByte 46 | 47 | 48 | Application 49 | false 50 | v142 51 | true 52 | MultiByte 53 | 54 | 55 | Application 56 | true 57 | v141 58 | MultiByte 59 | 60 | 61 | Application 62 | false 63 | v141 64 | true 65 | MultiByte 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | $(SolutionDir)Out\$(Configuration)\ 87 | $(SolutionDir)Temp\$(Configuration)\ 88 | 89 | 90 | $(SolutionDir)Temp\$(Configuration)\ 91 | $(SolutionDir)Out\$(Configuration)\ 92 | 93 | 94 | 95 | Level3 96 | Disabled 97 | true 98 | true 99 | 100 | 101 | 102 | 103 | Level3 104 | Disabled 105 | true 106 | true 107 | ..\Code\Include 108 | 109 | 110 | _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) 111 | 112 | 113 | 114 | 115 | Level3 116 | MaxSpeed 117 | true 118 | true 119 | true 120 | true 121 | 122 | 123 | true 124 | true 125 | 126 | 127 | 128 | 129 | Level3 130 | MaxSpeed 131 | true 132 | true 133 | true 134 | true 135 | ..\Code\Include 136 | true 137 | _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) 138 | /Zc:twoPhase- %(AdditionalOptions) 139 | 140 | 141 | true 142 | true 143 | 144 | 145 | 146 | 147 | 148 | -------------------------------------------------------------------------------- /VS2017/SegmentTracing-EG2020.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;ipp;xsd 11 | 12 | 13 | 14 | 15 | Source Files 16 | 17 | 18 | Source Files 19 | 20 | 21 | Source Files 22 | 23 | 24 | Source Files 25 | 26 | 27 | Source Files 28 | 29 | 30 | 31 | 32 | Header Files 33 | 34 | 35 | Header Files 36 | 37 | 38 | Header Files 39 | 40 | 41 | Header Files 42 | 43 | 44 | -------------------------------------------------------------------------------- /VS2017/SegmentTracing-EG2020.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /VS2017/SegmentTracing.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.28307.489 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SegmentTracingEG2020", "SegmentTracing-EG2020.vcxproj", "{B3831FC6-FED7-4E0E-A51F-9D1C542F616E}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x64 = Debug|x64 11 | Release|x64 = Release|x64 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {B3831FC6-FED7-4E0E-A51F-9D1C542F616E}.Debug|x64.ActiveCfg = Debug|x64 15 | {B3831FC6-FED7-4E0E-A51F-9D1C542F616E}.Debug|x64.Build.0 = Debug|x64 16 | {B3831FC6-FED7-4E0E-A51F-9D1C542F616E}.Release|x64.ActiveCfg = Release|x64 17 | {B3831FC6-FED7-4E0E-A51F-9D1C542F616E}.Release|x64.Build.0 = Release|x64 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {54E250FB-F8C4-405C-9FA9-6E48590DA611} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /VS2019/SegmentTracing-EG2020.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | Debug 14 | x64 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 15.0 36 | {B3831FC6-FED7-4E0E-A51F-9D1C542F616E} 37 | SegmentTracingEG2020 38 | 10.0.18362.0 39 | 40 | 41 | 42 | Application 43 | true 44 | v142 45 | MultiByte 46 | 47 | 48 | Application 49 | false 50 | v142 51 | true 52 | MultiByte 53 | 54 | 55 | Application 56 | true 57 | v142 58 | MultiByte 59 | 60 | 61 | Application 62 | false 63 | v142 64 | true 65 | MultiByte 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | $(SolutionDir)Out\$(Configuration)\ 87 | $(SolutionDir)Temp\$(Configuration)\ 88 | 89 | 90 | $(SolutionDir)Temp\$(Configuration)\ 91 | $(SolutionDir)Out\$(Configuration)\ 92 | 93 | 94 | 95 | Level3 96 | Disabled 97 | true 98 | true 99 | 100 | 101 | 102 | 103 | Level3 104 | Disabled 105 | true 106 | true 107 | ..\Code\Include 108 | 109 | 110 | _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) 111 | 112 | 113 | 114 | 115 | Level3 116 | MaxSpeed 117 | true 118 | true 119 | true 120 | true 121 | 122 | 123 | true 124 | true 125 | 126 | 127 | 128 | 129 | Level3 130 | MaxSpeed 131 | true 132 | true 133 | true 134 | true 135 | ..\Code\Include 136 | true 137 | _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) 138 | 139 | 140 | true 141 | true 142 | 143 | 144 | 145 | 146 | 147 | -------------------------------------------------------------------------------- /VS2019/SegmentTracing-EG2020.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;ipp;xsd 11 | 12 | 13 | 14 | 15 | Source Files 16 | 17 | 18 | Source Files 19 | 20 | 21 | Source Files 22 | 23 | 24 | Source Files 25 | 26 | 27 | Source Files 28 | 29 | 30 | 31 | 32 | Header Files 33 | 34 | 35 | Header Files 36 | 37 | 38 | Header Files 39 | 40 | 41 | Header Files 42 | 43 | 44 | -------------------------------------------------------------------------------- /VS2019/SegmentTracing-EG2020.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /VS2019/SegmentTracing.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.28307.489 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SegmentTracingEG2020", "SegmentTracing-EG2020.vcxproj", "{B3831FC6-FED7-4E0E-A51F-9D1C542F616E}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x64 = Debug|x64 11 | Release|x64 = Release|x64 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {B3831FC6-FED7-4E0E-A51F-9D1C542F616E}.Debug|x64.ActiveCfg = Debug|x64 15 | {B3831FC6-FED7-4E0E-A51F-9D1C542F616E}.Debug|x64.Build.0 = Debug|x64 16 | {B3831FC6-FED7-4E0E-A51F-9D1C542F616E}.Release|x64.ActiveCfg = Release|x64 17 | {B3831FC6-FED7-4E0E-A51F-9D1C542F616E}.Release|x64.Build.0 = Release|x64 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {54E250FB-F8C4-405C-9FA9-6E48590DA611} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /VS2022/SegmentTracing-EG2020.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | Debug 14 | x64 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 15.0 36 | {B3831FC6-FED7-4E0E-A51F-9D1C542F616E} 37 | SegmentTracingEG2020 38 | 10.0 39 | 40 | 41 | 42 | Application 43 | true 44 | v143 45 | MultiByte 46 | 47 | 48 | Application 49 | false 50 | v143 51 | true 52 | MultiByte 53 | 54 | 55 | Application 56 | true 57 | v143 58 | MultiByte 59 | 60 | 61 | Application 62 | false 63 | v143 64 | true 65 | MultiByte 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | $(SolutionDir)Out\$(Configuration)\ 87 | $(SolutionDir)Temp\$(Configuration)\ 88 | 89 | 90 | $(SolutionDir)Temp\$(Configuration)\ 91 | $(SolutionDir)Out\$(Configuration)\ 92 | 93 | 94 | 95 | Level3 96 | Disabled 97 | true 98 | true 99 | 100 | 101 | 102 | 103 | Level3 104 | Disabled 105 | true 106 | true 107 | ..\Code\Include 108 | 109 | 110 | _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) 111 | 112 | 113 | 114 | 115 | Level3 116 | MaxSpeed 117 | true 118 | true 119 | true 120 | true 121 | 122 | 123 | true 124 | true 125 | 126 | 127 | 128 | 129 | Level3 130 | MaxSpeed 131 | true 132 | true 133 | true 134 | true 135 | ..\Code\Include 136 | true 137 | _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) 138 | 139 | 140 | true 141 | true 142 | 143 | 144 | 145 | 146 | 147 | -------------------------------------------------------------------------------- /VS2022/SegmentTracing-EG2020.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;ipp;xsd 11 | 12 | 13 | 14 | 15 | Source Files 16 | 17 | 18 | Source Files 19 | 20 | 21 | Source Files 22 | 23 | 24 | Source Files 25 | 26 | 27 | Source Files 28 | 29 | 30 | 31 | 32 | Header Files 33 | 34 | 35 | Header Files 36 | 37 | 38 | Header Files 39 | 40 | 41 | Header Files 42 | 43 | 44 | -------------------------------------------------------------------------------- /VS2022/SegmentTracing-EG2020.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /VS2022/SegmentTracing.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.28307.489 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SegmentTracingEG2020", "SegmentTracing-EG2020.vcxproj", "{B3831FC6-FED7-4E0E-A51F-9D1C542F616E}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x64 = Debug|x64 11 | Release|x64 = Release|x64 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {B3831FC6-FED7-4E0E-A51F-9D1C542F616E}.Debug|x64.ActiveCfg = Debug|x64 15 | {B3831FC6-FED7-4E0E-A51F-9D1C542F616E}.Debug|x64.Build.0 = Debug|x64 16 | {B3831FC6-FED7-4E0E-A51F-9D1C542F616E}.Release|x64.ActiveCfg = Release|x64 17 | {B3831FC6-FED7-4E0E-A51F-9D1C542F616E}.Release|x64.Build.0 = Release|x64 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {54E250FB-F8C4-405C-9FA9-6E48590DA611} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /VS2022/render0.ppm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aparis69/Segment-Tracing/084b8268b798907316cbb44b6490cb2015c80374/VS2022/render0.ppm -------------------------------------------------------------------------------- /VS2022/render0_cost.ppm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aparis69/Segment-Tracing/084b8268b798907316cbb44b6490cb2015c80374/VS2022/render0_cost.ppm -------------------------------------------------------------------------------- /VS2022/render1.ppm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aparis69/Segment-Tracing/084b8268b798907316cbb44b6490cb2015c80374/VS2022/render1.ppm -------------------------------------------------------------------------------- /VS2022/render1_cost.ppm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aparis69/Segment-Tracing/084b8268b798907316cbb44b6490cb2015c80374/VS2022/render1_cost.ppm -------------------------------------------------------------------------------- /VS2022/render2.ppm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aparis69/Segment-Tracing/084b8268b798907316cbb44b6490cb2015c80374/VS2022/render2.ppm -------------------------------------------------------------------------------- /representative.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aparis69/Segment-Tracing/084b8268b798907316cbb44b6490cb2015c80374/representative.png --------------------------------------------------------------------------------