53 TriangularPlate::TriangularPlate(
const NaifTriangle &plate,
const int &plateId) :
55 m_plateId(plateId) { }
57 TriangularPlate::~TriangularPlate() { }
59 int TriangularPlate::id()
const {
64 return "TriangularPlate";
82 double radius = qMax(qMax(vnorm_c(
m_plate[0]), vnorm_c(
m_plate[1])),
87 Distance TriangularPlate::minRadius()
const {
88 double radius = qMin(qMin(vnorm_c(
m_plate[0]), vnorm_c(
m_plate[1])),
107 double s1 = vnorm_c(&edge[0]);
110 double s2 = vnorm_c(&edge[0]);
113 double s3 = vnorm_c(&edge[0]);
116 double S = (s1 + s2 + s3) / 2.0;
117 double p_area = std::sqrt(S * (S - s1) * (S - s2) * (S - s3));
142 ucrss_c(&edge1[0], &edge2[0], &norm[0]);
148 double third(0.33333333333333331);
173 double sepang = vsep_c(&norm[0], &raydir[0]);
228 vminus_c(&obs[0], &raydir[0]);
266 vminus_c(&obs[0], &raydir[0]);
325 if ( (v < 0) || (v > 2) ) {
326 QString msg =
"Unable to get TriangularPlate vertex for index ["
327 +
toString(v) +
"]. Valid index range is 0-2.";
330 for (
int i = 0 ; i < 3 ; i++ ) {
380 vsub_c(
m_plate[0], &obs[0], &e1[0]);
381 vsub_c(
m_plate[1], &obs[0], &e2[0]);
382 vsub_c(
m_plate[2], &obs[0], &e3[0]);
386 vcrss_c(&e1[0], &e2[0], &tnorm12[0]);
387 double tdot12 = vdot_c(&raydir[0], &tnorm12[0]);
388 double en = vdot_c(&e3[0], &tnorm12[0]);
392 if ( qFuzzyCompare(en+1.0, 1.0) )
return (
false);
395 if ( (en > 0.0) && (tdot12 < 0.0) )
return (
false);
396 if ( (en < 0.0) && (tdot12 > 0.0) )
return (
false);
401 vcrss_c(&e2[0], &e3[0], &tnorm23[0]);
402 double tdot23 = vdot_c(&raydir[0], &tnorm23[0]);
405 if ( (en > 0.0) && (tdot23 < 0.0) )
return (
false);
406 if ( (en < 0.0) && (tdot23 > 0.0) )
return (
false);
411 vcrss_c(&e3[0], &e1[0], &tnorm31[0]);
412 double tdot31 = vdot_c(&raydir[0], &tnorm31[0]);
415 if ( (en > 0.0) && (tdot31 < 0.0) )
return (
false);
416 if ( (en < 0.0) && (tdot31 > 0.0) )
return (
false);
420 double denom = tdot12 + tdot23 + tdot31;
428 if ( qFuzzyCompare(denom+1.0, 1.0) )
return (
false);
430 double scale = en / denom;
432 vlcom_c(1.0, &obs[0], scale, &raydir[0], &xpt[0]);