Go to the documentation of this file.
78 static bool hasReadWriteTypes(
const word& readType,
const word& writeType)
80 volatile bool good =
true;
98 int main(
int argc,
char *argv[])
102 "Transform (translate / rotate / scale) surface points.\n"
103 "Like transformPoints but for surfaces.\n"
104 "Note: roll=rotate about x, pitch=rotate about y, yaw=rotate about z"
113 "Translate by specified <vector> - eg, '(1 0 0)' before rotations"
119 "Use specified <point> as origin for rotations"
125 "Rotate from <vectorA> to <vectorB> - eg, '((1 0 0) (0 0 1))'"
131 "Rotate <angle> degrees about <vector> - eg, '((1 0 0) 45)'"
137 "Rotate by '(roll pitch yaw)' degrees"
143 "Rotate by '(yaw pitch roll)' degrees"
149 "Scale by the specified amount - Eg, for uniform [mm] to [m] scaling "
150 "use either '(0.001 0.001 0.001)' or simply '0.001'"
156 "Input format (default: use file extension)"
162 "Output format (default: use file extension)"
182 <<
"No operation supplied, "
183 <<
"use at least one of the following:" <<
nl
186 for (
const auto& opName : operationNames)
200 const word readFileType
205 const word writeFileType
212 if (!hasReadWriteTypes(readFileType, writeFileType))
215 <<
"Unsupported file format(s)" <<
nl
220 Info<<
"Reading surf from " << importName <<
" ..." <<
nl
221 <<
"Writing surf to " << exportName <<
" ..." <<
endl;
231 Info<<
"Translating points by " << v <<
endl;
240 Info<<
"Set origin for rotations to " << origin <<
endl;
255 Info<<
"Rotating points by " << rot <<
endl;
265 const vector& axis = rotAxisAngle.first();
266 const scalar& angle = rotAxisAngle.second();
268 Info<<
"Rotating points " <<
nl
269 <<
" about " << axis <<
nl
270 <<
" angle " << angle <<
nl;
274 Info<<
"Rotating points by " << rot <<
endl;
279 Info<<
"Rotating points by" <<
nl
280 <<
" roll " << v.x() <<
nl
281 <<
" pitch " << v.y() <<
nl
282 <<
" yaw " << v.z() <<
nl;
286 Info<<
"Rotating points by " << rot <<
endl;
291 Info<<
"Rotating points by" <<
nl
292 <<
" yaw " << v.x() <<
nl
293 <<
" pitch " << v.y() <<
nl
294 <<
" roll " << v.z() <<
nl;
298 Info<<
"Rotating points by " << rot <<
endl;
313 &&
equal(scaling[0], scaling[1])
314 &&
equal(scaling[0], scaling[2])
318 Info<<
"Scaling points uniformly by " << scaling[0] <<
nl;
321 else if (scaling.size() == 3)
323 Info<<
"Scaling points by ("
326 << scaling[2] <<
')' <<
nl;
335 <<
"-scale with 1 or 3 components only" <<
nl
336 <<
"given: " <<
args[
"scale"] <<
endl
343 Info<<
"Unset origin for rotations from " << origin <<
endl;
348 surf1.write(exportName, writeFileType);
label count(const UList< word > &optionNames) const
Return how many of the specified options were used.
word lessExt() const
Return word without extension (part before last .)
A class for handling words, derived from Foam::string.
A class for handling file names.
T getOrDefault(const word &optName, const T &deflt) const
Get a value from the named option if present, or return default.
static bool canReadType(const word &fileType, bool verbose=false)
Can we read this file format? Also checks friend types.
static constexpr const zero Zero
Global zero (0)
static void addNote(const string ¬e)
Add extra notes for the usage information.
Extract command arguments and options from the supplied argc and argv parameters.
bool readListIfPresent(const word &optName, List< T > &list) const
Ostream & endl(Ostream &os)
Add newline and flush stream.
word ext() const
Return file name extension (part after last .)
static bool canWriteType(const word &fileType, bool verbose=false)
Can we write this file format? Also checks proxy types.
dimensionSet transform(const dimensionSet &ds)
Return the argument; transformations do not change the dimensions.
bool readIfPresent(const word &optName, T &val) const
Read a value from the named option if present.
static void addArgument(const string &argName, const string &usage="")
Append a (mandatory) argument to validArgs.
ITstream lookup(const word &optName) const
Return an input stream from the named option.
static tensor rotation(const vector &axis, const scalar angle, bool degrees=false)
The rotation tensor for given axis/angle.
messageStream Info
Information stream (uses stdout - output is on the master only)
Namespace for coordinate system rotations.
word name(const complex &c)
Return string representation of complex.
void replace(const direction, const UList< cmptType > &)
Replace a component field of the field.
tmp< Field< cmptType > > component(const direction) const
Return a component field of the field.
errorManipArg< error, int > exit(error &err, const int errNo=1)
An ordered pair of two objects of type <T> with first() and second() elements.
Input/output from file streams.
static tensor rotation(const vector &angles, bool degrees=false)
tensor rotationTensor(const vector &n1, const vector &n2)
Rotational transformation tensor from vector n1 to n2.
static void noParallel()
Remove the parallel options.
static void addOption(const word &optName, const string ¶m="", const string &usage="", bool advanced=false)
Add an option to validOptions with usage information.
Foam::argList args(argc, argv)
bool equal(const T &s1, const T &s2)
Compare two values for equality.
bool found(const word &optName) const
Return true if the named option is found.