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


10

try: f = FindGeometricTransform[pointSetNoise, pointSetPerfect] I know it's too short for an answer, but that's it. The result can be tested like this: ListPlot[{f[[2]][pointSetPerfect], pointSetNoise}, Axes -> False, Frame -> True]


9

RotationTransform[a Pi, {1, 0, 0}] is nothing more than a matrix, so you can compose/combine such functions using matrix multiplication. For example: Graphics3D[{EdgeForm[None], GeometricTransformation[Cylinder[], RotationTransform[.5 Pi, {1, 0, 0}].RotationTransform[0.2 Pi, {0, 1, 0}].RotationTransform[0.1 Pi, {0, 1, 0}]]}] In the above code ...


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

Use Composition: Manipulate[Graphics3D[{EdgeForm[None], GeometricTransformation[Cylinder[], Composition[ RotationTransform[a Pi, {1, 0, 0}], RotationTransform[b Pi, {0, 1, 0}], RotationTransform[c Pi, {0, 1, 0}]]]}], {{a, 0}, -1, 1}, {{b, 0}, -1, 1}, {{c, 0}, -1, 1}, SaveDefinitions -> True] (I'm not sure which order you ...


7

Here is a method based on image manipulations, which means I pre-suppose a certain pixel resolution with which the crash is detected: tip[rg_] := {EdgeForm[Thin], FaceForm[White], Polygon[{{0, 4}, {0, 0.2}, {0.5 - rg, 0}, {0.5 + rg, 0}, {1, 0.2}, {1, 4}}], FaceForm[Black], Rectangle[{0.4, 0}, {0.6, 1}]}; box = {EdgeForm[Thin], FaceForm[Blue], ...


6

This works by making an interpolation function in initialization, which represents the surface. Each time the prob is moved, it finds the Euclidean distance between the current tip position and the surface at the x-coordinates at the time. It checks that this distance is not smaller than some crash tolerance constant value set in the initialization. (This ...


5

Testing overlapping polygons One can use the testpoint function from this answer to 9405, which I will call inPolygonQ: inPolygonQ[poly_?MatrixQ, pt_?VectorQ] := Round[(Total @ Mod[(# - RotateRight[#]) &@ (ArcTan @@ (pt - #) & /@ poly), 2 Pi, -Pi]/2/Pi)] != 0; In V8/V9, there is the undocumented function Graphics`Mesh`InPolygonQ which may ...


5

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

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


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


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