Tag Info

Hot answers tagged

12

Rotation about the origin MapIndexed[N@Nest[r, #1, First[#2-1]] &, points] {{0., 0., 0.}, {0.984808, 0.173648, 0.}, {1.87939, 0.68404, 0.}, {2.59808, 1.5, 0.}, {3.06418, 2.57115, 0.}, {3.21394, 3.83022, 0.}} ListPlot[%[[All, {1, 2}]]] the norm of the vectors is conserved. Rotation about the last point Ok, with the new request, rotating ...


12

Using Composition I can apply RotationTransform, TranslationTransform , ShearingTransform one after the other. Graphics3D[{ Opacity[1] , Red , Arrow[{{0, 0, 0}, {1, 0, 0}}] , Green , Arrow[{{0, 0, 0}, {0, 1, 0}}] , Blue , Arrow[{{0, 0, 0}, {0, 0, 1}}] , Opacity[0.2] , GeometricTransformation[Cuboid[-{1, 1, 1}/4, {1, 1, 1}/4], ...


8

With your figure l1 = Line[{{0, 1}, {1, 1}}]; cir = Circle[{1, 0}, 1, {-π/2, π]/2}]; l2 = Line[{{0, -1}, {1, -1}}]; geom = {l1, cir, l2}; g = Graphics[geom]; and the rectangle marker l = 0; hw = 0.01; hh = 0.05; marker = Rasterize@Magnify[Graphics@Rectangle[{l - hw, hh}, {l + hw, -hh}], 0.07] one can create a binary image from the figure bg = ...


7

im1 = Import["http://i.stack.imgur.com/78jWB.png"]; {cx, cy} = {50, 50}; cen = ComponentMeasurements[im1, "Centroid"][[All, 2]][[1]]; im2 = ImageForwardTransformation[im1, (# + {cx, cy} - cen) &, DataRange -> Full]; (* or ImageForwardTransformation[im1, TranslationTransform[{cx, cy}-cen], DataRange -> Full] *) im3 = ImageTransformation[im1, (# - ...


7

The easiest way to think about it is to iteratively bend the "line" of points as the program "moves" down the list. "Moves" is accomplished with Rest. The result regrettably has extra data that needs to be discarded, which is done with the ...[[All, 1]] bit of code. rot = N@NestList[ Rest@RotationTransform[10 Degree, {0, 0, 1}, #1[[1]]][#1] &, ...


7

Just use MeshFunction. Manipulate[ParametricPlot3D[{Sin[\[Theta]] Cos[\[Phi]], Sin[\[Theta]] Sin[\[Phi]], Cos[\[Theta]]}, {\[Theta], 0, \[Pi]}, {\[Phi], 0, 2 \[Pi]}, PlotStyle -> Opacity[0.5], Mesh -> {{0.}}, MeshStyle -> {Red, Thick}, MeshFunctions -> {Sin[a] Cos[b] #1 + Sin[a] Sin[b] #2 + Cos[a] #3 &}], {a, 0, \[Pi]}, {b, 0, 2 \[Pi]}] ...


6

Some of this code is based on the last example of the docs on GradientOrientationFilter You can also smooth out the resulting path and reparametrize the interpolation based on the curve length to get a "constant velocity" displacement for the rectangle- l1 = Line[{{0, 1}, {1, 1}}]; cir = Circle[{1, 0}, 1, {-π/2, π/2}]; l2 = Line[{{0, -1}, {1, -1}}]; geom = ...


6

I reported the issue to WRI on November 21. On December 16 they confirmed that it is a known bug. (I forgot to update the question till now.)


5

Looks to me to be a bug in RegionPlot. I say fhis beccause DiscretizeRegion @ TransformedRegion[Rectangle[{0, 0}, {1, 1}], {#1^(1/3) + #2, 1 + #2} &] gives as expected.


4

Some days ago,I look at a python's module called turtle.And I think weather we can simulate the behavier of some functions in turtle. First,I define some pre-function: initial[position_, th_] := Module[{θ = th, pos = position}, left := Function[theta, θ = θ + theta]; right := Function[theta, θ = θ - theta]; forward := Function[r, pos = pos + r*{Cos[θ], ...


3

Here's how I arrived at this (admittedly, quite ugly) mapping function: The "right" function to map points from cylinder coordinates to image coordinates in a pinhole camera model is the one MarcoB linked to in his comment. In a nutshell: {Sin[u],Cos[u],v,1} converts from cylinder coordinates u,v to (homogeneous) 3d coordinates which you then multiply by ...


3

Motivation In Mathematica most curves are ultimately rendered using Line, which has a straightforward derivative. Therefore it makes sense to create a function that solves the problem for the particular case of a Line object. For example pts = Flatten[Cases[Plot[Sin[x], {x, 0, 2 Pi}], Line[pts_] :> pts, Infinity], 1]; is the list of points which make ...


3

if you want to maintain the original distances between points I would also suggest the following: points1 = points = Most /@ {{0, 0, 0}, {1, 0, 0}, {2, 0, 0}, {3, 0, 0}, {4, 0, 0}, {5, 0, 0}}; l = Length[points]; n = 1; While[n++; n <= l , points[[n ;;]] = RotationTransform[10 Degree, points[[n - 1]]][#] & /@ points[[n ;;]]]; ...


2

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, ...


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 ...


2

Here is another approach (to simplify i give a 2D solution - your problem is in 2D - but it can be easily extended in 3D) : (* the coordinates of the first point *) ori = {0, 0}; (* the initial angles between the succesive points *) angles = {0, 0, 0, 0} (* the function to build the coordinates from the angles *) mkpts[ang_] := FoldList[(#1 + {Cos@#2, ...


2

You have to use the TransformationMatrix instead of the TransformationFunction: TransformationMatrix@result[[2]] {{0., -1., 0., 4.}, {1., 0., 0., 1.}, {0., 0., 1., 0.}, {0., 0., 0., 1.}} TransformationMatrix@result[[2]].m {{0., -1., 0., 2.}, {1., 0., 0., 2.}, {0., 0., 1., 0.}, {0., 0., 0., 1.}}


1

I guess there is some floating-point-related issue here... This works: f[t_] := RegionPlot[ TransformedRegion[ Rectangle[{-1, -1}, {1, 1}], { Indexed[#1, {1}] (1 + t (Indexed[#1, {2}]^2 - 1)) + 2 t, Indexed[#1, {2}] (1 + t (Indexed[#1, {1}]^2 - 1)) + 2 t } & ], PlotRange -> {{-1 + 2 t, 1 + 2 t}, {-1 + 2 t, 1 + 2 t}} ] ...


1

You can extract the matrix from result using Part: result[[2, 1]].m {{0., -1., 0., 2.}, {1., 0., 0., 2.}, {0., 0., 1., 0.}, {0., 0., 0., 1.}}



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