MCPcopy Create free account
hub / github.com/NatronGitHub/Natron / orient2dadapt

Function orient2dadapt

Engine/CoonsRegularization.cpp:1101–1189  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1099} // fast_expansion_sum_zeroelim
1100
1101static double
1102orient2dadapt(const Point &pa,
1103 const Point &pb,
1104 const Point& pc,
1105 double detsum)
1106{
1107 double acx, acy, bcx, bcy;
1108 double acxtail, acytail, bcxtail, bcytail;
1109 double detleft, detright;
1110 double detlefttail, detrighttail;
1111 double det, errbound;
1112 double B[4], C1[8], C2[12], D[16];
1113 double B3;
1114 int C1length, C2length, Dlength;
1115 double u[4];
1116 double u3;
1117 double s1, t1;
1118 double s0, t0;
1119 double bvirt;
1120 double avirt, bround, around;
1121 double c;
1122 double abig;
1123 double ahi, alo, bhi, blo;
1124 double err1, err2, err3;
1125 double _i, _j;
1126 double _0;
1127
1128 /* 2^ceiling(p/2) + 1. Used to split floats in half. */
1129 double epsilon = std::numeric_limits<double>::epsilon() * 0.5;
1130 static const double splitter = std::sqrt( (std::numeric_limits<double>::digits % 2 ? 2.0 : 1.0) / epsilon ) + 1.0;
1131 static const double ccwerrboundB = (2.0 + 12.0 * epsilon) * epsilon;
1132 static const double ccwerrboundC = (9.0 + 64.0 * epsilon) * epsilon * epsilon;
1133 static const double resulterrbound = (3.0 + 8.0 * epsilon) * epsilon;
1134
1135 acx = pa.x - pc.x;
1136 bcx = pb.x - pc.x;
1137 acy = pa.y - pc.y;
1138 bcy = pb.y - pc.y;
1139
1140 Two_Product(acx, bcy, detleft, detlefttail);
1141 Two_Product(acy, bcx, detright, detrighttail);
1142
1143 Two_Two_Diff(detleft, detlefttail, detright, detrighttail,
1144 B3, B[2], B[1], B[0]);
1145 B[3] = B3;
1146
1147 det = estimate(4, B);
1148 errbound = ccwerrboundB * detsum;
1149 if ( (det >= errbound) || (-det >= errbound) ) {
1150 return det;
1151 }
1152
1153 Two_Diff_Tail(pa.x, pc.x, acx, acxtail);
1154 Two_Diff_Tail(pb.x, pc.x, bcx, bcxtail);
1155 Two_Diff_Tail(pa.y, pc.y, acy, acytail);
1156 Two_Diff_Tail(pb.y, pc.y, bcy, bcytail);
1157
1158 if ( (acxtail == 0.0) && (acytail == 0.0)

Callers 1

orient2dFunction · 0.85

Calls 3

estimateFunction · 0.85
sqrtFunction · 0.50

Tested by

no test coverage detected