void printSection(Point_dt p1, Point_dt p2) { // System.out.println("G: "+p1); // System.out.println("C: "+p2); double dx = p1.distance(p2); double z1 = p1.z + this._dt.z(p1).z; double z2 = p2.z + this._dt.z(p2).z; double dz = z2 - z1; double gap = 100000; for (int i = 0; i < _section.Count; i++) { Point_dt curr = _section.ElementAt(i); double d = curr.distance(p1); double z = z1 + dz * (d / dx); double dzz = z - curr.z; if (gap > dzz) { gap = dzz; } // System.out.println(i+") dist1:"+curr.distance(p1)+" dist2:"+curr.distance(p2)+" c.z:"+curr.z+" Z:"+z+" block:"+(curr.z>z)); Console.WriteLine(i + ") dist1:" + curr.distance(p1) + " dist2:" + curr.distance(p2) + " Curr: " + curr + " DZ:" + (z - curr.z) + " block:" + (curr.z > z)); } Console.WriteLine("Triangle size: " + _tr.Count + " min Gap:" + gap); }
void Add(Point_dt p) { int len = _section.Count; if (p != null && (len == 0 || _p1.distance(p) > _p1.distance(_section .ElementAt(len - 1)))) { _section.Add(p); } }
Point_dt intersection(Point_dt q1, Point_dt q2) { Point_dt ans = null; double x1 = _p1.x, x2 = _p2.x; double xx1 = q1.x, xx2 = q2.x; double dx = x2 - x1, dxx = xx2 - xx1; if (dx == 0 && dxx == 0) { ans = q1; if (q2.distance(_p1) < q1.distance(_p1)) { ans = q2; } } else if (dxx == 0) { ans = new Point_dt(q1.x, f(_p1, _p2, q1.x), fz(_p1, _p2, q1.x)); } else if (dx == 0) { ans = new Point_dt(_p1.x, f(q1, q2, _p1.x), fz(q1, q1, _p1.x)); } else { double x = (k(_p1, _p2) - k(q1, q2)) / (m(q1, q2) - m(_p1, _p2)); double y = m(_p1, _p2) * x + k(_p1, _p2); double z = mz(q1, q2) * x + kz(q1, q2); ans = new Point_dt(x, y, z); } return(ans); }
void printSection(Point_dt p1, Point_dt p2) { // System.out.println("G: "+p1); // System.out.println("C: "+p2); double dx = p1.distance(p2); double z1 = p1.z + this._dt.z(p1).z; double z2 = p2.z + this._dt.z(p2).z; double dz = z2 - z1; double gap = 100000; for (int i = 0; i < _section.Count; i++) { Point_dt curr = _section.ElementAt(i); double d = curr.distance(p1); double z = z1 + dz * (d / dx); double dzz = z - curr.z; if (gap > dzz) gap = dzz; // System.out.println(i+") dist1:"+curr.distance(p1)+" dist2:"+curr.distance(p2)+" c.z:"+curr.z+" Z:"+z+" block:"+(curr.z>z)); Console.WriteLine(i + ") dist1:" + curr.distance(p1) + " dist2:" + curr.distance(p2) + " Curr: " + curr + " DZ:" + (z - curr.z) + " block:" + (curr.z > z)); } Console.WriteLine("Triangle size: " + _tr.Count + " min Gap:" + gap); }
Point_dt intersection(Point_dt q1, Point_dt q2) { Point_dt ans = null; double x1 = _p1.x, x2 = _p2.x; double xx1 = q1.x, xx2 = q2.x; double dx = x2 - x1, dxx = xx2 - xx1; if (dx == 0 && dxx == 0) { ans = q1; if (q2.distance(_p1) < q1.distance(_p1)) ans = q2; } else if (dxx == 0) { ans = new Point_dt(q1.x, f(_p1, _p2, q1.x), fz(_p1, _p2, q1.x)); } else if (dx == 0) { ans = new Point_dt(_p1.x, f(q1, q2, _p1.x), fz(q1, q1, _p1.x)); } else { double x = (k(_p1, _p2) - k(q1, q2)) / (m(q1, q2) - m(_p1, _p2)); double y = m(_p1, _p2) * x + k(_p1, _p2); double z = mz(q1, q2) * x + kz(q1, q2); ans = new Point_dt(x, y, z); } return ans; }