OffsetGeometry.cpp 2.89 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
// ------------------------------------------------------------------------
// $RCSfile: OffsetGeometry.cpp,v $
// ------------------------------------------------------------------------
// $Revision: 1.1.1.1 $
// ------------------------------------------------------------------------
// Copyright: see Copyright.readme
// ------------------------------------------------------------------------
//
// Class: OffsetGeometry
//    Represents a geometry which is offset with respect to some global
//    (super) geometry.
//
// ------------------------------------------------------------------------
// Class category: BeamlineGeometry
// ------------------------------------------------------------------------
//
// $Date: 2000/03/27 09:32:34 $
// $Author: fci $
//
// ------------------------------------------------------------------------

#include "BeamlineGeometry/OffsetGeometry.h"


// Class OffsetGeometry.
// ------------------------------------------------------------------------

28
OffsetGeometry::OffsetGeometry(const BGeometryBase &g, const BGeometryBase &l,
gsell's avatar
gsell committed
29 30 31 32 33
                               const Euclid3D &t):
    global(g), local(l), g2l(t)
{}


34
OffsetGeometry::OffsetGeometry(const BGeometryBase &g, const Euclid3D &t):
gsell's avatar
gsell committed
35 36 37 38 39
    global(g), local(g), g2l(t)
{}


OffsetGeometry::OffsetGeometry(const OffsetGeometry &og):
40
    BGeometryBase(og),
gsell's avatar
gsell committed
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 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126
    global(og.global), local(og.local), g2l(og.g2l)
{}


OffsetGeometry::~OffsetGeometry()
{}


double OffsetGeometry::getArcLength() const {
    return global.getArcLength();
}


double OffsetGeometry::getElementLength() const {
    return global.getElementLength();
}


Euclid3D OffsetGeometry::getGtoL() const {
    return g2l;
}


void OffsetGeometry::setGtoL(const Euclid3D &t) {
    g2l = t;
}


double OffsetGeometry::getOrigin() const {
    return global.getOrigin();
}


double OffsetGeometry::getEntrance() const {
    return global.getEntrance();
}


double OffsetGeometry::getExit() const {
    return global.getExit();
}


Euclid3D OffsetGeometry::getTransform(double fromS, double toS) const {
    return global.getTransform(fromS, toS);
}


Euclid3D OffsetGeometry::getTotalTransform() const {
    return global.getTotalTransform();
}


Euclid3D OffsetGeometry::getTransform(double s) const {
    return global.getTransform(s);
}


Euclid3D OffsetGeometry::getEntranceFrame() const {
    return global.getEntranceFrame();
}


Euclid3D OffsetGeometry::getExitFrame() const {
    return global.getExitFrame();
}


Euclid3D OffsetGeometry::getEntrancePatch() const {
    return getGlobalToLocalTransform(global.getEntrance(), local.getEntrance());
}


Euclid3D OffsetGeometry::getExitPatch() const {
    return Inverse(getGlobalToLocalTransform(global.getExit(), local.getExit()));
}


Euclid3D OffsetGeometry::getGlobalToLocalTransform
(double gs, double ls) const {
    Euclid3D tl = local.getTransform(ls);
    Euclid3D tgi = Inverse(local.getTransform(gs));

    return tl * g2l * tgi;
}