nec2++  1.7.0
Public Member Functions | Static Public Member Functions | List of all members
nec_wire Class Reference

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_wireintersect (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)
 

Detailed Description

A class to handle properties of wires.

Member Function Documentation

static void nec_wire::int_solve ( nec_3vector a0,
nec_3vector a1,
nec_3vector b0,
nec_3vector b1,
nec_float &  distance,
nec_float &  sa,
nec_float &  sb 
)
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 \

  • a1x)*b0x + 2*(-a0y + a1y)*b0y + 2*(-a0z + a1z)*b0z + ((-4*(a0x^2 + a0y^2 + \ a1x*b0x - a0x*(a1x + b0x) + a1y*b0y - a0y*(a1y + b0y) + (a0z - a1z)*(a0z - \ b0z))*((a0x - a1x)*(b0x - b1x) + (a0y - a1y)*(b0y - b1y) + (a0z - a1z)*(b0z \
  • b1z)) + 4*((a0x - a1x)^2 + (a0y - a1y)^2 + (a0z - a1z)^2)*((a0x - \ b0x)*(b0x - b1x) + (a0y - b0y)*(b0y - b1y) + (a0z - b0z)*(b0z - \ b1z)))*(-2*(a0x - a1x)*(b0x - b1x) - 2*(a0y - a1y)*(b0y - b1y) - 2*(a0z - \ a1z)*(b0z - b1z)))/(-4*((a0x - a1x)*(b0x - b1x) + (a0y - a1y)*(b0y - b1y) + \ (a0z - a1z)*(b0z - b1z))^2 + 4*((a0x - a1x)^2 + (a0y - a1y)^2 + (a0z - \ a1z)^2)*((b0x - b1x)^2 + (b0y - b1y)^2 + (b0z - b1z)^2)))/(2*((a0x - a1x)^2 \
  • (a0y - a1y)^2 + (a0z - a1z)^2))

sb -> -((-4*(a0x^2 + a0y^2 + a1x*b0x - \ a0x*(a1x + b0x) + a1y*b0y - a0y*(a1y + b0y) + (a0z - a1z)*(a0z - b0z))*((a0x \

  • a1x)*(b0x - b1x) + (a0y - a1y)*(b0y - b1y) + (a0z - a1z)*(b0z - b1z)) + \ 4*((a0x - a1x)^2 + (a0y - a1y)^2 + (a0z - a1z)^2)*((a0x - b0x)*(b0x - b1x) + \ (a0y - b0y)*(b0y - b1y) + (a0z - b0z)*(b0z - b1z)))/(-4*((a0x - a1x)*(b0x - \ b1x) + (a0y - a1y)*(b0y - b1y) + (a0z - a1z)*(b0z - b1z))^2 + 4*((a0x - \ a1x)^2 + (a0y - a1y)^2 + (a0z - a1z)^2)*((b0x - b1x)^2 + (b0y - b1y)^2 + \ (b0z - b1z)^2)))

Referenced by intersect().

std::vector<nec_wire> nec_wire::intersect ( nec_wire b)
inline

Calculate whether two wires intersect.

Returns
A list of the wires that should be created.

References int_solve().

Referenced by c_geometry::geometry_complete(), and c_geometry::wire().

bool nec_wire::intersect ( nec_3vector b0)
inline

Calculate whether the point is inside the wire.

Returns
true if the point x is inside the wire

The documentation for this class was generated from the following file: