StraightGeometry.h 3.92 KB
Newer Older
gsell's avatar
gsell committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
#ifndef CLASSIC_StraightGeometry_HH
#define CLASSIC_StraightGeometry_HH

// ------------------------------------------------------------------------
// $RCSfile: StraightGeometry.h,v $
// ------------------------------------------------------------------------
// $Revision: 1.1.1.1 $
// ------------------------------------------------------------------------
// Copyright: see Copyright.readme
// ------------------------------------------------------------------------
//
// Class: StraightGeometry
//
// ------------------------------------------------------------------------
// Class category: BeamlineGeometry
// ------------------------------------------------------------------------
//
// $Date: 2000/03/27 09:32:34 $
// $Author: fci $
//
// ------------------------------------------------------------------------

#include "BeamlineGeometry/Geometry.h"

// Class StraightGeometry
// ------------------------------------------------------------------------
/// A geometry representing a straight line.
//  StraightGeometry represents a straight line segment along the local
//  z-axis with no torsion. The origin is defined at the centre of the
//  segment, and the geometry runs from -length/2 to +length/2.  All
//  transformations are correspondingly only simple translations along
//  the z-axis.

34
class StraightGeometry : public BGeometryBase {
gsell's avatar
gsell committed
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
public:

    /// Constructor.
    //  Using the [b]length[/b].
    StraightGeometry(double length = 0.0);

    StraightGeometry(const StraightGeometry &right);
    virtual ~StraightGeometry();
    const StraightGeometry &operator=(const StraightGeometry &right);

    /// Get arc length.
    //  Return the arc length, identical to the straight design length.
    virtual double getArcLength() const;

    /// Get design length.
    //  Return the straight design length.
    virtual double getElementLength() const;

    /// Set design length.
    //  Assign the straight design length.
    virtual void setElementLength(double length);

    /// Get origin.
    //  Return the arc length from the entrance to the origin of the element
    //  (origin >= 0)
    double getOrigin() const;

    /// Get entrance.
    //  Return the arc length from the origin to the entrance of the element
    //  (entrance <= 0)
    double getEntrance() const;

    /// Get exit.
    //  Return the arc length from the origin to the exit of the element
    //  (exit >= 0)
    double getExit() const;

    /// Get transform.
    //  Return the transform of the local coordinate system from the
    //  position [b]fromS[/b] to the position [b]toS[/b].
    Euclid3D getTransform(double fromS, double toS) const;

    /// Get transform.
    //  Equivalent to getTransform(0.0, s).
    //  Return the transform of the local coordinate system from the
    //  origin and [b]s[/b].
    Euclid3D getTransform(double s) const;

    /// Get transform.
    //  Equivalent to getTransform(getEntrance(), getExit()).
    //  Return the transform of the local coordinate system from the
    //  entrance to the exit of the element.
    Euclid3D getTotalTransform() const;

    /// Get transform.
    //  Equivalent to getTransform(0.0, getEntrance()).
    //  Return the transform of the local coordinate system from the
    //  origin to the entrance of the element.
    Euclid3D getEntranceFrame() const;

    /// Get transform.
    //  Equivalent to getTransform(0.0, getExit()).
    //  Return the transform of the local coordinate system from the
    //  origin to the exit of the element.
    Euclid3D getExitFrame()     const;

private:

    // The design length.
    double len;
};

// inlined (trivial) member functions

inline StraightGeometry::StraightGeometry(double l): len(l)
{}

112 113
inline StraightGeometry::StraightGeometry(const StraightGeometry &right):
    BGeometryBase(right), len(right.len)
gsell's avatar
gsell committed
114 115 116 117 118 119 120 121 122
{}

inline const StraightGeometry &StraightGeometry::operator=
(const StraightGeometry &rhs) {
    len = rhs.len;
    return *this;
}

#endif // CLASSIC_StraightGeometry_HH