1#ifndef PHYTH_CURRENT_SEGMENT_HPP
2#define PHYTH_CURRENT_SEGMENT_HPP
51 throw std::invalid_argument(
"CurrentSegment: segment length must be non-zero");
71 throw std::runtime_error(
"CurrentSegment: point lies on the wire axis");
Magnetic field from a straight current-carrying wire segment.
Vector3< Quantity< Tesla > > GetMagneticFieldAt(const Vector3< Quantity< Meter > > &point) const override
Compute the magnetic field at a point.
CurrentSegment(const Vector3< Quantity< Meter > > &start, const Vector3< Quantity< Meter > > &end, const Quantity< Ampere > ¤t)
Construct a current segment from start to end.
Vector3< Scalar > direction_
Vector3< Quantity< Meter > > start_
bool IsPointOnWire(const Vector3< Quantity< Meter > > &point) const
Check if a point lies on the wire segment.
const Vector3< Quantity< Meter > > & GetStart() const
const Vector3< Quantity< Meter > > & GetEnd() const
Vector3< Quantity< Tesla > > AnalyticSolution(const Vector3< Quantity< Meter > > &point) const
Closed-form Biot-Savart solution for a finite straight wire.
Quantity< Ampere > current_
Quantity< Meter > GetLength() const
Quantity< Meter > length_
Quantity< Meter > GetMinimumDistanceTo(const Vector3< Quantity< Meter > > &point) const
Compute the minimum distance from a point to the wire segment.
Vector3< Quantity< Meter > > end_
Quantity< Ampere > GetCurrent() const
Abstract base class for all magnetic field sources.
auto sqrt(Quantity< UnitT > q)
Square root of a quantity.
Quantity< UnitT > max(Quantity< UnitT > x, Quantity< UnitT > y)
Maximum of two quantities.
Physical quantity with a value and a compile-time unit.
3D vector with Quantity components