Tag Info

Hot answers tagged

14

lin[cam_, obj_][t_] := cam t + (1 - t) obj s[cam_, obj_] := First@Solve[lin[cam, obj][t][[3]] == 0, t]; tr[cam_, obj_] := lin[cam, obj][t] /. s[cam, obj] // FullSimplify And that's it: tr[ ] i your transformation function. Let's test it with a Rubik's cube, simulating the video you linked. The following boring part is building the cube. We will make only ...


11

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


9

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


8

I think the "ugly thing" might be because texture is interpolated on triangles (demonstrated after), and a quadrangle is only divided into 2 triangles - up-left and down-right. So to solve the problem, we just need a triangulation network with much higher resolution. One way is to use ParametricPlot: ParametricPlot[ Evaluate[tr@{u, v}], {u, ...


7

Here is the general answer for any shaped object of surface genus-0, though it can have holes as long as it's an outer boundary (maybe its more general and someone can correct me). I will first describe the general UV mapping. This is usually done for a surface with a pre-chosen boundary, you need to choose which points are part of the boundary and give ...


6

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


6

Here's an unwrapping of the side of the cylinder, if that is what you are after. With the OP's polys and pts (CoordinateTransform taken from @Kuba's answer), we begin by selecting only the polygons on the side of the cylinder (sidepolys). (There's no noise in this data, at least as far as the end caps go, so the tolerance tol could be set to 0.) pts2 = ...


4

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

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


3

If (a,b) is a point in Affine space, then its projective coordinates are [a:b:1]. To select the representative on the unit sphere we can choose (a/r,b/r,1/r) where r=sqrt(a^2+b^2+1). Revering the transformation, given a point on the unit sphere (x,y,z) we can recover the affine point [a:b:1] as [x/z:y/z:1]. Using this idea try: ContourPlot3D[x^2 + y^2 + z^2 ...


3

You can use something designed for creating such ilusion :) pic = Import["ExampleData/lena.tif"]; Manipulate[ Graphics3D[{Texture@pic, Polygon[{{0, 0, 0}, {0, 1, 0}, {1, 1, 0}, {1, 0, 0}}, VertexTextureCoordinates -> {{0, 0}, {1, 0}, {1, 1}, {0, 1}}]}, ViewVertical -> {0, 0, 1}, ViewVector -> {{-.2, .5, h}, {100, .5, ...


2

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


1

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


1

Although your code produces a picture of a "spiral staircase", there are some choices of parameters the escape my understanding, so let's look at simplified version with some debugging code added. Module[{t, g}, g = Graphics3D[ t = Table[ GeometricTransformation[ Cuboid[{1, 0, 0}, {.01, .2, .1}], {RotationMatrix[a, {0, 0, 1}],(* ...


1

If you indent the code, it's easier to see its structure Graphics3D[ Table[ GeometricTransformation[ Cuboid[{1, 0, 0}, {.01, .2, .1}], {RotationMatrix[ a, {0, 0, .05}], {.001 Cos[a], .001 Sin[a], a}}], {a, -[Pi], 2 Pi, .2} ], Boxed -> False ] Graphics3D is a container for three-dimensional graphics objects, ...


1

A rotation in 3D does not have a centre point, technically -- just an axis. The reason that Solve complains is that there should be a one-parameter family of solutions. But since the TransformationFunction is in terms of approximate reals, it is slightly off. Things that should cancel out exactly and produce a null space of dimension one do not. But they ...



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