- **OpenFOAM Pre-Processing**
(*http://www.cfd-online.com/Forums/openfoam-pre-processing/*)

- - **SurfaceTransformPoints rotate suggestion for improvement**
(*http://www.cfd-online.com/Forums/openfoam-pre-processing/62011-surfacetransformpoints-rotate-suggestion-improvement.html*)

Hello All,
We found it veryHello All,
We found it very hard to understand the necessary input definition for rotating some surface object using the utility surfaceTransformPoints. One needs to supply 2 vectors which are used to construct a rotation matrix. We finally found how this matrix is constructed from these two vectors but were not able to find out how to relate the vectors to some kind of desired rotation. Therefore I modified the utility such that you only need to supply three angles of rotation (rotX, rotY, rotZ), which seems much more intuitively. The code now reads: argList::validOptions.insert("rotate", "'(degrX degrY degrZ)'"); ... ... if (args.options().found("rotate")) { using namespace mathematicalConstant; vector angles = (IStringStream(args.options()["rotate"])()); scalar phiX = pi*angles[0]/180; scalar phiY = pi*angles[1]/180; scalar phiZ = pi*angles[2]/180; tensor Rx (1, 0, 0, 0, Foam::cos(phiX), Foam::sin(phiX), 0, -Foam::sin(phiX), Foam::cos(phiX)); tensor Ry (Foam::cos(phiY), 0, -Foam::sin(phiY), 0, 1, 0, Foam::sin(phiY), 0, Foam::cos(phiY)); tensor Rz (Foam::cos(phiZ), Foam::sin(phiZ), 0, -Foam::sin(phiZ), Foam::cos(phiZ), 0, 0, 0, 1); tensor T (Rz & Ry & Rx); Info<< "Rotating points by " << T << endl; points = transform(T, points); } Attached the complete code. Hopefully it is usefull for people. Brgds, Mark |

All times are GMT -4. The time now is 00:26. |