2
$\begingroup$

I have a 2D graphic which contains a table of curves within a circular region.

rotateparametric[parfunc_, fixedpoint_, angle_] := 
  RotationMatrix[angle].(parfunc - fixedpoint) + fixedpoint;
viewAngle = Pi/3;
ctrVolume = {(Exp[(Pi - viewAngle)*0.5] + 1)/2, 0};
radiusVolume = (Exp[(Pi - viewAngle)*0.5] - 1)/2;
radiusRing = (Exp[(Pi - viewAngle)*0.5] + 1)/2;
FPS = 120*3;
fPlanet = 3; 
fOrbit = 10;
radiusEquation = Exp[t*0.5];
planetRotation = 
 rotateparametric[{radiusEquation*Cos[t], radiusEquation*Sin[t]}, {0, 
   0}, -2*Pi*i*fPlanet/FPS]
mirrorPlanetRotation = 
 rotateparametric[{radiusEquation*Cos[t], radiusEquation*Sin[t]}, {0, 
   0}, Pi - 2*Pi*i*fPlanet/FPS]
orbitRotation = 
 rotateparametric[planetRotation, ctrVolume, -2*Pi*i*fOrbit/FPS]
mirrorOrbitRotation = 
 rotateparametric[planetRotation, ctrVolume, Pi - 2*Pi*i*fOrbit/FPS]
TheCurves = Evaluate@Table[orbitRotation, {i, 1, FPS}];
TheMirrorCurves = Evaluate@Table[mirrorOrbitRotation, {i, 1, FPS}];
pp = ParametricPlot[{TheCurves, TheMirrorCurves}, {t, 0, 
   Pi - viewAngle}, 
  RegionFunction -> (Norm[{#, #2} - ctrVolume] <= radiusVolume &), 
  PlotRange -> All]

This is the output:

curves

What I want to do is first, divide the region into discrete little regions (meshes) which I will be the decider to the size of the mesh. For example like in below:

mesh in detail

Then I need to extract the tangent values of each curve within the mesh so I can calculate its perpendicular vectors angle as below:

mesh tangent

If it will be help, I need this to calculate the minimum voxel in a holographic volume. When I find the perpendicular vectors angle I will know the total view angle of the voxel (mesh). If the total angle covers 360 degree than it means I hit my goal. Thanks.

$\endgroup$
5
  • $\begingroup$ I don't see how this is related to the tags "finite-element-method". Please clarify. $\endgroup$ Commented Apr 2, 2019 at 9:28
  • $\begingroup$ i want to divide the region into meshes. if we talk about mesh don't also talk about finite element analysis? $\endgroup$
    – Alper91
    Commented Apr 2, 2019 at 10:11
  • 4
    $\begingroup$ "if we talk about mesh don't also talk about finite element analysis?" Nope. Finite element analysis is a method to solve partial differential equations. $\endgroup$ Commented Apr 2, 2019 at 10:15
  • $\begingroup$ I've read your question several times by now and I still have no clue what you want to do there. No clear aims, no example output, unclear definition of what you mean by "perpendicular vectors angle". That might be the reasons why you haven't got a complete answer yet. Also, notice that this is not a free coding service. $\endgroup$ Commented Apr 8, 2019 at 18:46
  • $\begingroup$ @HenrikSchumacher I wll try to make it more clear. You are right, 'perpendicular vectors angle' is a weird description but I couldn't find an exact term for it so I drew to explain what I meant. I will try to make it more clear. However, I am offended by your accusation. Mathematica only compiles scripts. Without a code, suggesting short operations like 'use this table', 'try to use this function' are useless. Because If I knew how to write them I wouldn't ask this question. Every answer here has code in it. And I don't think the answer providers think what they re doing is free coding service $\endgroup$
    – Alper91
    Commented Apr 8, 2019 at 19:04

1 Answer 1

1
+50
$\begingroup$

Not a full answer...

Look at a single curve, and discretize it. Also set a bounding box

curve = Table[TheCurves[[1]], {t, 0, Pi - viewAngle, π/1000}];

left = 2; right = 4; low = .2; high = 1;

ListPlot[curve, Epilog -> {FaceForm[], EdgeForm[Black], Rectangle[{left, low}, {right, high}]}]

enter image description here

Now compute tangents to the curve using finite differencing

arctans = ArcTan @@@ Normalize /@ Differences[curve];

This list is 1 element shorter than your discretized curve, so drop the last element from your curve list.

shortCurve = Most@curve;

You can pick off the location of points that are in a voxel with a function

pointsInVoxel[left_, right_, low_, high_, curve_] := 
             Position[curve, {x_, y_} /; (left <= x <= right && low <= y <= high)]

Tying it together

locations = pointsInVoxel[left, right, low, high, shortCurve]

ListPlot[{curve, Extract[shortCurve, locations]}, 
 Epilog -> {FaceForm[], EdgeForm[Black], Rectangle[{left, low}, {right, high}]}]

enter image description here

Extract[arctans, locations] // ListPlot

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.