New answers tagged

4

The solution is to work in grid positions, e.g. gridX × height and gridY × width to come up with screen coordinates that have to be corrected by an offset to line up the grid-origin one is using with its true screen coordinates. The position in the grid can be obtained by using Quotient thus returning the grid coordinates as integers. In the given example ...


2

Using ClipPlanes and ClipPlanesStyle Animate[Graphics3D[Cuboid[{2, -2, -1}, {-2, 2, 3}], ClipPlanes -> -{-t, -t, 1, 0}, Boxed -> False, ClipPlanesStyle -> Directive[Yellow, Opacity[0.5], Specularity[White, 30]] ], {{t, -0}, -3, 3}, AnimationRunning -> False]


5

Here is a standard algebraic approach, to complement @ubpdqn's geometric one. If we have a sequence of points $(x_i,y_i)$, $i=1,2,\dots,n$ lying on a circle, then the linear system $$A\,(x_i^2+y_i^2)+B\,x_i+C\,y_i+D=0,\quad i=1,2,\dots,n$$ will have a nontrivial solution $(A_0,B_0,C_0,D_0)$. If there are at least three distinct points not on a line, the ...


15

This is a motivating post. I have made no effort to deal with intersection <4 pts. I post only illustrative examples. The centre of the circle is the intersection of perpendicular bisectors of chords. f[a_, b_, c_, d_] := Module[{e1 = a x^2 + b, e2 = c y^2 + d, s, p, l, ln, ctr}, s = Solve[{x, e1} == {e2, y}, {x, y}, Reals]; p = {#, a #^2 + b} ...


8

Using points as given, you can use RotationMatrix,e.g. : Animate[Show[ ListPointPlot3D[RotationMatrix[a, {0, 1, 0}].# & /@ points, PlotStyle -> {Yellow, PointSize[0.02]}, PlotRange -> Table[{-30, 30}, {3}], Background -> Black, BoxRatios -> 1], Graphics3D[{Red, Thickness[0.01], Arrow[{{0, -30, 0}, {0, 30, 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]


0

the function FormCoef[x_,y_] defined in the package should give you the result you want. This function gives the "left-coefficient" of the differential form y in the differential form expression x, i.e., writes x as Wedge[w,y] + terms not containing y and returns w.


1

Manipulate[ Graphics[{Red, Circle[{0, 0}, Cos[Pi/n]], Blue, Circle[{0, 0}, 1], Green, Line[{Cos[2 Pi #/n], Sin[2 Pi #/n]} & /@ Range[0, 2 n]]}], {n, 3, 30, .2}]


0

If you have a function that generated the contour and you know the contour value, then you could just evaluate the function at each point in the second list and know whether the each point is in the contour, on the contour, or outside the contour. (I'm not try to be facetious. It's just that sometimes I don't always see the forest for the trees.) ...


4

Use BoundaryDiscretizeGraphics, RegionDifference, Select, and MemberQ points1 = CirclePoints[3, 40]; points2 = CirclePoints[1, 40]; {region1, region2} = BoundaryDiscretizeGraphics@*ListCurvePathPlot /@ {points1, points2} region3 = RegionDifference[region1, region2] Show[ RegionPlot@region3, Select[RandomReal[{-5, 5}, {1000, 2}], RegionMember[region3]] ...


2

p = {50, 10, 25}; l = InfiniteLine[{5, 5, 5}, {1, 1, 1}]; RegionDistance[l, p]


2

Is there a pre-defined function in Mathematica to get the distance from a point to a line? There isn't one, but thankfully for you, both EuclideanDistance[] and Projection[] are built-in: PointLineDistance[pt_, {s1_, s2_}] := With[{tp = s1 - pt}, EuclideanDistance[tp, Projection[tp, s2 - s1]]] Thus, PointLineDistance[{50, 10, 25}, ...


5

You can use RegionNearest pt = {50, 10, 25}; line = Line[Table[{5 + t, 5 + t, 5 + t}, {t, 0, 100}]]; npt = RegionNearest[line, pt]; Graphics3D[{line, Blue, Line[{pt, npt}], Red, Point[{pt, npt}]}]



Top 50 recent answers are included