# Tag Info

13

EulerMatrix is available in MMA 10. To obtain the matrix for the transformation shown in your sketch, apply EulerMatrix[{α,β,γ},{3,1,3}] This transformation is known as the x-convention, because the second rotation is about x'-axis. The Wikipedia designates this by ZXZ. Those who do not have MMA 10 can obtain the same x-convention transformation using ...

11

Here's a nice one-liner: TransformationFunction[{{1, 0, 0, 0}, {0, 0, -1, 0}, {0, 1, 0, 3}, {0, 0, 0, 1}}] // InverseFunction TransformationFunction[{{1, 0, 0, 0}, {0, 0, 1, -3}, {0, -1, 0, 0}, {0, 0, 0, 1}}] Note that TransformationFunction[] is the head of the results returned by geometric *Transform functions, which take a homogeneous transformation ...

10

To address your actual problem: If you're just looking to re-orient your B-spline cylinder, there's no need to go through the Euler angles. Here's one way. Consider the following cylinder: myCyl = BSplineSurface[{{{0, 0, 0}, {0, 1, 0}, {1, 1, 0}, {1, 0, 0}}, {{0, 0, 1}, {0, 1, 1}, {1, 1, 1}, {1, 0, 1}}}, ...

9

You are looking for TransformedRegion. GeometricTransformation is for transforming graphics primitives, but you are looking at region functionality. This is a case where the difference is important. Simply, t = TransformedRegion[p, AffineTransform@A] (* Parallelogram[{0, 0}, {{-1, 2}, {3, 0}}] *) where the AffineTransform was needed as TransformedRegion ...

8

You can use RotationTransform. With[{rot = funs[[3]] /. Inner[Rule, {x, y}, RotationTransform[π/2][{x, y}], List]}, ContourPlot[rot, {x, -.5, .5}, {y, -.5, .5}] ] Hope this helps. Also with Manipulate Manipulate[ With[{rot = funs[[3]] /. Inner[Rule, {x, y}, RotationTransform[θ][{x, y}], List]}, Quiet@ContourPlot[rot, {x, -.5, .5}, {y, -.5, .5}]],...

7

You can achieve the desired transformation with the ImageForwardTransformation function. The transformation effect is easily visible on a grid image: grid = Rasterize[ Graphics[Rectangle[], GridLines -> {Range[.05, .95, .05], Range[.05, .95, .05]}, GridLinesStyle -> Directive[{White, Thick}], Method -> {"GridLinesInFront" -> True}, ...

7

If you leave ContourPlot outside you can get quite nice performance: static = ContourPlot[45 x^2 + 20 y^2 == 45, {x, -2, 2}, {y, -2, 2}, Frame -> False]; dynamic = ContourPlot[8 x^2 + 4 x y + 5 y^2 == 9, {x, -2, 2}, {y, -2, 2}, Frame -> False, ContourStyle -> Orange]; Manipulate[ Graphics[{ First@static, Dynamic[Rotate[...

6

If you have a homogenous transformation matrix of the form $$\begin{bmatrix} \mathrm{R_{3 \times 3}} & \mathrm{d}_{3 \times 1} \\ 0_{1\times 3} & 1_{1\times 1} \end{bmatrix}$$ Then the inverse is given by $$\begin{bmatrix} \mathrm{R}^{-1} & -\mathrm{R}^{-1}\mathrm{d} \\ 0 & 1 \end{bmatrix}$$ Therefore, if your ...

6

rotation = {x, y}.{{Cos[t], Sin[t]}, {-Sin[t], Cos[t]}}; f[t_] = funs[[3]] /. {x -> rotation[[1]], y -> rotation[[2]]}; Manipulate[ ContourPlot[f[t], {x, -.3, .3}, {y, -.3, .3}], {t, -\[Pi], \[Pi]}]

6

Thanks for J.M.'s answer for coordinates transformation. With[{transpts = Map[Composition[TranslationTransform[{1, 1, 1}], RotationTransform[{{0, 0, 1}, {1, 2, 1}}]], pts]}, Graphics3D[ {PointSize[Large], Point[pts], Blue, Line[pts], Arrow[Tube[{{0, 0, 0}, {0, 0, 0} + 2 Normalize@{0, 0, 1}}]], Black, PointSize[Medium], Point[{0, 0, 0}]...

4

This is surely a bug. The misbehavior certainly persists through V10.2. In fact, the two images below are of the same computation. The only difference is where they appear on the screen (as I scrolled the notebook, the transformed red disk jumped around). μ = 0.16255558520216132 + 0.1849493244071408 I; pic[τ_] := Block[{d, ds, arc}, d = Disk[{0, 0},...

4

It seems like a nuisance coming from the interpolation used by ImageForwardTransformation when you use negative values of rpy[[2]]. The image looks grainy but overall OK without interpolation: gr = ImageForwardTransformation[mwpic, changeEcliptic[##, {0 Degree, -40 Degree, 00 Degree}] &, 640, PlotRange -> {{-π, π}, {0, π}}, ...

4

You can combine Graphics3D and the MeshRegion using their MeshPrimitives. For example, Show[Graphics3D[{Blue, Tetrahedron[]}], Graphics3D[{Red, MeshPrimitives[R, 1]}]] or Show[Graphics3D[{Opacity[0.3], Tetrahedron[]}], Graphics3D[{Red, MeshPrimitives[R, 1]}] /. Line -> Tube, Boxed -> False]

2

The only way I could find to add the ellipse you are asking for to your graphic was to compute a set of points along the ellipse and make line segments from them. Here is how I did it. The following generates the graphic you show int the question. origin = Point[{0, 0, 0}]; cone1 = Cone[{{0, 0, 1}, {0, 0, 0}}]; transform = {{0.3, 0, 0.15}, {0, 0.35, 0}, {0....

2

I forgot you have to remove the word Geometric! b = pts; r = RotationTransform[2 \[Pi]/3, pts[[3]]][pts[[{-1, 1, 2}]]]; l = RotationTransform[4 \[Pi]/3, pts[[3]]][pts[[{-1, 1}]]]; Graphics[{Green, Point@b, Red, Point@r, Yellow, Point@l}]

2

g2 just produces the same image g1 again The new rectangles in g2 are not visible because they are all red. Change Red to a random color and they become visible: g2 = Graphics[{Rectangle[], Hue[RandomReal[]], GeometricTransformation[g1[[1]], {T1, T2, T3, T4, T5, T6, T7, T8}]}] What I want to do is apply the eight transformations to g1 again, to ...

2

I understand the solution proposed in the comments by @YvesKlett has bee sufficient. However, I gave it a go out of curiousity and this seemed to work fine: Code: (*Dummy function*) f[x_, y_] := Sin[x^2 + y^2] Exp[-x^2] + Cos[x^2 + y^2] (*Sample data*) g2 = Plot3D[f[x, y], {x, -2, 2}, {y, -2, 2}, PlotPoints -> 50, Axes -> False, Boxed -> ...

2

Just as a complementary and extended comment and as was recently observed in a related post, you get exactly the same problem if, not surprisingly, you use geometric transformation functions instead: Given the initial object to transform: circles = {Circle[{0, 0}, 1], Circle[{0, 0.5}, 0.5]}; the OP transformation: t1 = Rotate[Scale[circles, 12], -45 ...

1

In version 10.2 (perhaps going back to 10.0, but I cannot verify that), by default STL's are imported as MeshRegion objects. Assuming that casefn is a string representing the path to an STL file, you can see all the elements available for import from the file Import[casefn, "Elements"] (*{"BinaryFormat", "BoundaryMeshRegion", "Comments", "...

1

Here is a quick answer (based on @J.M.'s comment) for a basic rotation: STLdata = Import["MyFile.stl", "GraphicsComplex"]; RotatedSTL = Graphics3D[ GeometricTransformation[STLdata, RotationTransform[30 Degree, {1, 1, 1}]], Axes -> True] Export["MyFileRotated.stl", RotatedSTL, {"STL","BinaryFormat" -> False}]

Only top voted, non community-wiki answers of a minimum length are eligible