Tag Info

Hot answers tagged

13

If you interpret your geometric shape as NURBS of degree 1 (linear), you can proceed with the following, extremely simple code: pts={{0, 0},{1, 1},{0.5, 1.5}}; (* just an example *) s=BSplineFunction[pts,SplineClosed->True,SplineDegree->1]; Animate[ParametricPlot[s[t],{t,0,1},Epilog:>{Red,PointSize[Large],Point[s[t]]}],{t, 0., 1.}] This yields ...


9

Here`s an alternative. pic = Import["http://i.stack.imgur.com/4xyhd.png"] Let's say you are lazy and you don't want to write mathematical equations. We can use built-in transformations to create domain, image of transformation, and create InterpolationFunction based on this data. data = Join @@ Table[{lat, long}, {lat, -89, 89}, {long, -179, 179}]; ...


8

Using Frame->False instead of Axes->False for your first approach seems to work well.


7

Both, DensityPlot and Graphics, with primitives like Circle and Disk, produce Graphics output. I think it is alright implementing your custom graphics. Here's my take, following your second idea, with a simple control over how the opacity fades. smooth[a_, R_: 1, n_: 100, hue_: Purple] := Graphics@Table[{ Blend[{Append[0]@hue, Append[1]@hue}, ...


6

e = {{0, 0}, {1, 1}, {5.5, 1.5}, {0, 0}}; (*triangle vertices*) (*point position as a function of time*) p[t_, e_] := Piecewise[{ {(1 - t)*e[[1]] + t*e[[2]], 0 <= t <= 1}, {(1 - (t - 1))*e[[2]] + (t - 1)*e[[3]], 1 < t <= 2}, {(1 - (t - 2))*e[[3]] + (t - 2)*e[[1]], 2 < t <= 3} }]; (*animation*) Animate[ Show[ ...


6

Thanks to kguler, I now know there is something like: LineScaledCoordinate. vertices = Table[{Cos[i], Sin[i]}, {i, 0, 2 Pi, 2 Pi/3.}]; Needs["GraphUtilities`"] Slider[Dynamic@t] Graphics[{ EdgeForm @ Thick, FaceForm @ None, Polygon @ vertices , AbsolutePointSize @ 12, Red, Dynamic[Point[LineScaledCoordinate[vertices, t]]] } ] Just in ...


4

Another way: circim = Graphics[{White, Disk[]}, Background -> Black]; ImageMultiply[LinearGradientImage[{Blue, Yellow, Red}], circim] Or ImageMultiply[RadialGradientImage[{Blue, Yellow, Red}], circim] One can compose such a figure with transparency as: ImageCompose[EiffelTower, {mybullseye, .5}] where the .5 is the transparency ...


4

Using RegionNearest Imagine the triangle as a one-dimensional region, r1, a line, embedded in a plane. r1 = Line[{{0, 0}, {3, 1}, {2, 0}, {0, 0}}]; RegionDimension[r1] RegionEmbeddingDimension[r1] 1 2 Get the radius of a circle, with the triangle centroid as center, that intersects the farthest vertex of the triangle. c = RegionCentroid[r1]; (* ...


4

Based on data in Comm ACM. This took a while to only partially automate, largely through a helper function that spreads out the years: diffuse[a_][years_List] := Module[{x0 = 1, x1 = Length[years], y0 = Min[years], y1 = Max[years]}, years // MapIndexed[ {#1, (((y1 - y0)/(x1 - x0))*(First[#2] - x0) + y0) a + (#1) (1 - a)} ...


3

First, some remark : with Mathematica you don't have to "initialize" lists : you can directly input set1 and set2 like this : set1 = {"A" -> "B", "B" -> "C", "D" -> "F", "A" -> "F", "G" -> "B", "H" -> "C", "C" -> "G"}; set2 = {"B" -> "A", "B" -> "C", "D" -> "G", "A" -> "F", "G" -> "H", "H" -> "D", "B" -> ...


1

Tak a closer look at documentation: data = RandomReal[1, {100, 2}]; Histogram3D[data, {{.2}, {.5}}] The following bin specifications bpsec can be given: {w} use bins of width w (...) {xspec,yspec} give different x and y specifications ergo: {{wx}, {wy}}


1

Internally LineScaledCoordinate use Position[d, _?(#1 >= t &)] to detect a current segment. Here d is an accumulated list of distances (relative to the total length of segments). However, algebraic expressions are not atomic: t = 0.5; d = {0, 1/(3 + Sqrt[2]), 3/(3 + Sqrt[2]), 1}; Position[d, _?(#1 >= t &)] Position[N@d, _?(#1 >= t ...



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