/usr/include/camitk-3.2/libraries/lml/Direction.h is in libcamitk3-dev 3.2.2-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 34 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 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 | /*****************************************************************************
* $CAMITK_LICENCE_BEGIN$
*
* CamiTK - Computer Assisted Medical Intervention ToolKit
* (c) 2001-2013 UJF-Grenoble 1, CNRS, TIMC-IMAG UMR 5525 (GMCAO)
*
* Visit http://camitk.imag.fr for more information
*
* This file is part of CamiTK.
*
* CamiTK is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* CamiTK is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with CamiTK. If not, see <http://www.gnu.org/licenses/>.
*
* $CAMITK_LICENCE_END$
****************************************************************************/
#ifndef DIRECTION_H
#define DIRECTION_H
#include <iostream>
#include "libxml/xmlIO.h"
/** Class that defines the direction of the Load with x, y and z.
*/
class Direction {
public:
/// default constructor: nothing is specified
Direction() : x(0.0), y(0.0), z(0.0), xState(NOT_SPECIFIED), yState(NOT_SPECIFIED), zState(NOT_SPECIFIED), towardIndex(-1) {};
/// constructor with initialization of the toward
Direction(const unsigned int toward) { setToward(toward); };
/// constructor with initialization of the 3 directions
Direction(double x0, double y0, double z0) { setX(x0); setY(y0); setZ(z0); };
/// copy constructor
Direction(const Direction & d) { x=d.x; xState=d.xState; y=d.y; yState=d.yState; z=d.z; zState=d.zState; towardIndex=d.towardIndex;};
/// print to an ostream
void xmlPrint(std::ostream & o) const {
o << "\t<direction ";
if (isToward()) {
o << "toward=\"" << towardIndex << "\"";
}
else {
switch (xState) {
case NOT_SPECIFIED:
break;
case NULL_DIR:
o << "x=\"NULL\" ";
break;
case SPECIFIED:
o << "x=\"" << x << "\" ";
break;
default:
break;
}
switch (yState) {
case NOT_SPECIFIED:
break;
case NULL_DIR:
o << "y=\"NULL\" ";
break;
case SPECIFIED:
o << "y=\"" << y << "\" ";
break;
default:
break;
}
switch (zState) {
case NOT_SPECIFIED:
break;
case NULL_DIR:
o << "z=\"NULL\"";
break;
case SPECIFIED:
o << "z=\"" << z << "\"";
break;
default:
break;
}
}
o << "/>" << std::endl;
};
/// set the direction
void set(const double x, const double y, const double z) {
setX(x);setY(y);setZ(z);
};
/// get the toward index
int getToward() const {
return towardIndex;
};
/// set the toward index
void setToward(const unsigned int toward) {
towardIndex=toward;
xState = yState = zState = TOWARD;
};
/// true only if the direction is set by a toward atom
bool isToward() const {
return (towardIndex>=0 && xState==TOWARD && yState==TOWARD && zState==TOWARD);
};
///@name X direction
//@{
/// get the x coordinate
double getX() const { return x; };
/// is the x coordinate NULL ?
bool isXNull() const { return (xState==NULL_DIR); };
/// is the x coordinate specified
bool isXSpecified() const { return (xState==SPECIFIED); };
/// set the x coordinate as NULL
void setNullX() { x=0.0; xState = NULL_DIR; };
/// set the x coordinate
void setX(const double x) { this->x = x; xState = SPECIFIED; };
//@}
///@name Y direction
//@{
/// get the y coordinate
double getY() const { return y; };
/// is the y coordinate NULL ?
bool isYNull() const { return (yState==NULL_DIR); };
/// is the y coordinate specified
bool isYSpecified() const { return (yState==SPECIFIED); };
/// set the y coordinate as NULL
void setNullY() { y=0.0; yState = NULL_DIR; };
/// set the y coordinate
void setY(const double y) { this->y = y; yState = SPECIFIED; };
//@}
///@name Z direction
//@{
/// get the z coordinate
double getZ() const { return z; };
/// is the z coordinate NULL ?
bool isZNull() const { return (zState==NULL_DIR); };
/// is the z coordinate specified
bool isZSpecified() const { return (zState==SPECIFIED); };
/// set the z coordinate as NULL
void setNullZ() { z=0.0; zState = NULL_DIR; };
/// set the z coordinate
void setZ(const double z) { this->z = z; zState = SPECIFIED; };
//@}
private:
/// state of the x,y and z
enum DirState {
NOT_SPECIFIED, //!< the direction has never been specified: it is absolutly free
NULL_DIR, //!< the direction has been specified to be always null
SPECIFIED, //!< the direction has been specified to be something imposed but not null (even 0.0 is possible!)
TOWARD //!< the direction is set dynamically depending on the "toward" position
};
/// x coordinates
double x;
/// y coordinates
double y;
/// z coordinates
double z;
/// state for the x coordinates
DirState xState;
/// state for the y coordinates
DirState yState;
/// state for the z coordinates
DirState zState;
/// toward atom index
int towardIndex;
};
#endif //DIRECTION_H
|