nec2++
1.7.0
|
A class to handle properties of wires. More...
#include <nec_wire.h>
Public Member Functions | |
nec_wire (const nec_3vector &a, const nec_3vector &b, nec_float in_radius, int id) | |
nec_3vector | parametrize (nec_float s) const |
nec_float | distance (const nec_3vector &a, const nec_3vector &b) const |
nec_float | length () const |
int | tag_id () const |
std::vector< nec_wire > | intersect (nec_wire &b) |
Calculate whether two wires intersect. More... | |
bool | intersect (nec_3vector &b0) |
Calculate whether the point is inside the wire. More... | |
bool | similar (nec_wire &b) |
Static Public Member Functions | |
static void | int_solve (nec_3vector &a0, nec_3vector &a1, nec_3vector &b0, nec_3vector &b1, nec_float &distance, nec_float &sa, nec_float &sb) |
A class to handle properties of wires.
|
inlinestatic |
We use the following Mathematica expression to get the solution for the intersection of two cylinders. We set up the distance between the two center lines as d2
The equations are derived from sympy in the file intersections.py
d2 = (a0x - b0x + sa*(a1x - a0x) - sb*(b1x - b0x))^2 + (a0z - b0z + sa*(a1z - a0z) - sb*(b1z - b0z))^2 + (a0y - b0y + sa*(a1y - a0y) - sb*(b1y - b0y))^2;
soln = Solve[{D[d2,sa] == 0, D[d2,sb] == 0}, {sa,sb}]; Simplify[soln]
sa -> (2*a0x*(a0x - a1x) + 2*a0y*(a0y - a1y) + 2*a0z*(a0z - a1z) + 2*(-a0x \
sb -> -((-4*(a0x^2 + a0y^2 + a1x*b0x - \ a0x*(a1x + b0x) + a1y*b0y - a0y*(a1y + b0y) + (a0z - a1z)*(a0z - b0z))*((a0x \
Referenced by intersect().
Calculate whether two wires intersect.
References int_solve().
Referenced by c_geometry::geometry_complete(), and c_geometry::wire().
|
inline |
Calculate whether the point is inside the wire.