1010// / @parblock
1111// /
1212// / Persistence of Vision Ray Tracer ('POV-Ray') version 3.8.
13- // / Copyright 1991-2018 Persistence of Vision Raytracer Pty. Ltd.
13+ // / Copyright 1991-2019 Persistence of Vision Raytracer Pty. Ltd.
1414// /
1515// / POV-Ray is free software: you can redistribute it and/or modify
1616// / it under the terms of the GNU Affero General Public License as
@@ -401,14 +401,14 @@ static constexpr POV_INT64 CX_IPOW(POV_INT64 base, int exp, POV_INT64 result) {
401401// / * solve_quadratic()
402402// /
403403// / @note
404- // / The setting is used to set internal 'constextr int PRECISE_DIG ' and
405- // / 'constexpr DBL PRECISE_EPSILON ' typed values.
404+ // / The setting is used to set internal 'constextr int gkPrecise_dig ' and
405+ // / 'constexpr DBL gkPrecise_epsilon ' typed values.
406406// /
407407// / @note
408408// / If @ref PRECISE_FLOAT is set to 'float', 'double' or 'long double', the C++11 standard
409409// / itself defines via cfloat include the macros: FLT_DIG, DBL_DIG, LDBL_DIG, FLT_EPSILON,
410- // / DBL_EPSILON, LDBL_EPSILON. These macro values are used to set PRECISE_DIG and
411- // / PRECISE_EPSILON values via the C++ constexpr mechanism.
410+ // / DBL_EPSILON, LDBL_EPSILON. These macro values are used to set gkPrecise_dig and
411+ // / gkPrecise_epsilon values via the C++ constexpr mechanism.
412412// /
413413// / @attention
414414// / Math with data types not run in hardware or with awkward bit sizes with
@@ -463,32 +463,33 @@ static constexpr POV_INT64 CX_IPOW(POV_INT64 base, int exp, POV_INT64 result) {
463463 #define PRECISE_EPSLN 1.92592994438724e-34
464464#endif
465465
466- // / @var PRECISE_FLT
466+ // / @var gkPrecise_flt
467467// / A 'constexpr int' 0 when @ref PRECISE_FLOAT resolves to float type or !=0 otherwise.
468468// /
469- // / @var PRECISE_DBL
469+ // / @var gkPrecise_dbl
470470// / A 'constexpr int' 0 when @ref PRECISE_FLOAT resolves to double type or !=0 otherwise.
471471// /
472- // / @var PRECISE_LDBL
472+ // / @var gkPrecise_ldbl
473473// / A 'constexpr int' 0 when @ref PRECISE_FLOAT resolves to long double type or !=0 otherwise.
474474// /
475- // / @var PRECISE_DIG
475+ // / @var gkPrecise_dig
476476// / A 'constexpr int' maximum decimal digits given @ref PRECISE_FLOAT.
477477// /
478478// / Set to C+11 standard value where defined and to @ref PRECISE_DIGITS otherwise.
479479// /
480- constexpr int PRECISE_FLT = CX_STRCMP(CX_XSTR(PRECISE_FLOAT), " float" );
481- constexpr int PRECISE_DBL = CX_STRCMP(CX_XSTR(PRECISE_FLOAT), " double" );
482- constexpr int PRECISE_LDBL = CX_STRCMP(CX_XSTR(PRECISE_FLOAT), " long double" );
480+ constexpr int gkPrecise_flt = CX_STRCMP(CX_XSTR(PRECISE_FLOAT), " float" );
481+ constexpr int gkPrecise_dbl = CX_STRCMP(CX_XSTR(PRECISE_FLOAT), " double" );
482+ constexpr int gkPrecise_ldbl = CX_STRCMP(CX_XSTR(PRECISE_FLOAT), " long double" );
483483
484- constexpr int PRECISE_DIG = PRECISE_FLT ?
485- PRECISE_DBL ?
486- PRECISE_LDBL ? PRECISE_DIGITS
487- : LDBL_DIG
488- : DBL_DIG
489- : FLT_DIG;
484+ constexpr int gkPrecise_dig =
485+ gkPrecise_flt ?
486+ gkPrecise_dbl ?
487+ gkPrecise_ldbl ? PRECISE_DIGITS
488+ : LDBL_DIG
489+ : DBL_DIG
490+ : FLT_DIG;
490491
491- // / @var PRECISE_EPSILON
492+ // / @var gkPrecise_epsilon
492493// / A 'constexpr DBL' value for minimum epsilon step given @ref PRECISE_FLOAT.
493494// /
494495// / Set to C+11 standard value*2.0 where defined and to @ref PRECISE_EPSLN*2.0 otherwise.
@@ -497,38 +498,40 @@ constexpr int PRECISE_DIG = PRECISE_FLT ?
497498// / Using 2.0 multiplier due maths calculating coefficients for higher order polynomials
498499// / introducing more than single bit/step error in practice.
499500// /
500- constexpr DBL PRECISE_EPSILON = PRECISE_FLT ?
501- PRECISE_DBL ?
502- PRECISE_LDBL ? PRECISE_EPSLN*2.0
503- : LDBL_EPSILON*2.0
504- : DBL_EPSILON*2.0
505- : FLT_EPSILON*2.0 ;
501+ constexpr DBL gkPrecise_epsilon =
502+ gkPrecise_flt ?
503+ gkPrecise_dbl ?
504+ gkPrecise_ldbl ? PRECISE_EPSLN*2.0
505+ : LDBL_EPSILON*2.0
506+ : DBL_EPSILON*2.0
507+ : FLT_EPSILON*2.0 ;
506508
507- // / @var POV_DBL_IS_FLT
509+ // / @var gkDBL_is_flt
508510// / A 'constexpr int' 0 when @ref DBL resolves to float type or !=0 otherwise.
509511// /
510- // / @var POV_DBL_IS_DBL
512+ // / @var gkDBL_is_dbl
511513// / A 'constexpr int' 0 when @ref DBL resolves to double type or !=0 otherwise.
512514// /
513- // / @var POV_DBL_IS_LDBL
515+ // / @var gkDBL_is_ldbl
514516// / A 'constexpr int' 0 when @ref DBL resolves to long double type or !=0 otherwise.
515517// /
516- // / @var POV_DBL_DIG
518+ // / @var gkDBL_dig
517519// / A 'constexpr int' value for maximum decimal digits for given @ref DBL.
518520// /
519521// / Set to C+11 standard value where defined and to @ref PRECISE_DIGITS otherwise.
520522// /
521- constexpr int POV_DBL_IS_FLT = CX_STRCMP(CX_XSTR(DBL), " float" );
522- constexpr int POV_DBL_IS_DBL = CX_STRCMP(CX_XSTR(DBL), " double" );
523- constexpr int POV_DBL_IS_LDBL = CX_STRCMP(CX_XSTR(DBL), " long double" );
524- constexpr int POV_DBL_DIG = POV_DBL_IS_FLT ?
525- POV_DBL_IS_DBL ?
526- POV_DBL_IS_LDBL ? PRECISE_DIGITS
527- : LDBL_DIG
528- : DBL_DIG
529- : FLT_DIG;
530-
531- // / @var POV_DBL_EPSILON
523+ constexpr int gkDBL_is_flt = CX_STRCMP(CX_XSTR(DBL), " float" );
524+ constexpr int gkDBL_is_dbl = CX_STRCMP(CX_XSTR(DBL), " double" );
525+ constexpr int gkDBL_is_ldbl = CX_STRCMP(CX_XSTR(DBL), " long double" );
526+ constexpr int gkDBL_dig =
527+ gkDBL_is_flt ?
528+ gkDBL_is_dbl ?
529+ gkDBL_is_ldbl ? PRECISE_DIGITS
530+ : LDBL_DIG
531+ : DBL_DIG
532+ : FLT_DIG;
533+
534+ // / @var gkDBL_epsilon
532535// / A 'constexpr DBL' value for minimum epsilon step for given POV-Ray's @ref DBL.
533536// /
534537// / Set to C+11 standard value*2.0 where defined and to @ref PRECISE_EPSLN*2.0 otherwise.
@@ -541,24 +544,25 @@ constexpr int POV_DBL_DIG = POV_DBL_IS_FLT ?
541544// / Using 2.0 multiplier due maths calculating coefficients for higher order polynomials
542545// / introducing more than single bit/step error in practice.
543546// /
544- constexpr DBL POV_DBL_EPSILON = POV_DBL_IS_FLT ?
545- POV_DBL_IS_DBL ?
546- POV_DBL_IS_LDBL ? PRECISE_EPSLN*2.0
547- : LDBL_EPSILON*2.0
548- : DBL_EPSILON*2.0
549- : FLT_EPSILON*2.0 ;
547+ constexpr DBL gkDBL_epsilon =
548+ gkDBL_is_flt ?
549+ gkDBL_is_dbl ?
550+ gkDBL_is_ldbl ? PRECISE_EPSLN*2.0
551+ : LDBL_EPSILON*2.0
552+ : DBL_EPSILON*2.0
553+ : FLT_EPSILON*2.0 ;
550554
551555
552- // / @var MIN_ISECT_DEPTH_RETURNED
556+ // / @var gkMinIsectDepthReturned
553557// / A 'constexpr DBL' value below which roots from primitive objects are not returned.
554558// /
555559// / The value will track @ref DBL float type and is very roughly the square root
556- // / of the determined POV_DBL_EPSILON . The plan is to migrate base shapes to
560+ // / of the determined gkDBL_epsilon . The plan is to migrate base shapes to
557561// / this single value instead of the many different thresholds used today.
558562// / Aiming for both more accuracy and something which automatically adjust to
559563// / the DBL type used.
560564// /
561- constexpr DBL MIN_ISECT_DEPTH_RETURNED = POV_DBL_EPSILON *(DBL)CX_IPOW(10 ,POV_DBL_DIG /2 +1 );
565+ constexpr DBL gkMinIsectDepthReturned = gkDBL_epsilon *(DBL)CX_IPOW(10 ,gkDBL_dig /2 +1 );
562566
563567// / @}
564568// /
0 commit comments