How to use Normal to recover translated points [duplicate]












2












$begingroup$



This question already has an answer here:




  • Why doesn't Normal work?

    2 answers




enter image description here



I'm working through a coding exercise to program a matrix of Lissajour Curves in Mathematica but have encountered an obstacle when trying to recover the translated Point to then do further processing on them (as seen through the link). I've encountered problems trying to recovering the updated coordinates of translated points using Normal before. In this case I've gone so far as to try to rebuild that solution in my current notebook to no avail. It seems like there should be some application of Normal to Graphics[graphicsdata] that would generate the updated point coordinates in a list. I'm not sure what I'm missing about how Normal works but it would be useful to understand it as I try to advance my Mathematica program complexity.



angle = Drop[Range[0,Pi 2,(2 Pi)/20],-1];
cols = 5;
rows = 3;
radius = .45;

functionXY[anglevar_]:= {radius * Cos[anglevar],radius * Sin[anglevar]}

translatevectors = Flatten[{Table[{x,0},{x,cols}],Table[{0,-y},{y,rows}]},1];
points = Point /@ functionXY /@ angle;
graphicsdata = Table[Translate[#, translatevectors[[n]]] &/@ points,{n,Length@translatevectors}];
Graphics[graphicsdata]




Updated Dec 29 2018



I just thought it would be helpful to post the updated code here using the suggestions below should others find themselves in the postion of Normal not recovering translated coordinates as expected. In this case it is probably better to use TranslationTransform in the first place as now graphicsdata returns exactly the updated point's new coordinates that can be further post-processed.



elementaryPoints = functionXY /@ angle;
graphicsdata = Table[TranslationTransform[translatevectors[[n]]]@# &/@ elementaryPoints,{n,Length@translatevectors}];
Table[Point /@ graphicsdata[[n]],{n, Length@translatevectors}] // Graphics


enter image description here










share|improve this question











$endgroup$



marked as duplicate by Carl Woll list-manipulation
Users with the  list-manipulation badge can single-handedly close list-manipulation questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Dec 29 '18 at 21:26


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.















  • $begingroup$
    maybe normal = # /. Translate[(prim : Alternatives[Point, Line, Circle])[x_, y___], t_] :> prim[TranslationTransform[t]@x, y] &; normal@Graphics[graphicsdata]? `
    $endgroup$
    – kglr
    Dec 29 '18 at 3:39










  • $begingroup$
    I'm new to being able to close questions with one vote, so if you think this shouldn't be closed, just let me know.
    $endgroup$
    – Carl Woll
    Dec 29 '18 at 21:27










  • $begingroup$
    I'd suggest not closing it. I rarely see the overlap and it has two votes now anyways.
    $endgroup$
    – BBirdsell
    Dec 30 '18 at 1:51
















2












$begingroup$



This question already has an answer here:




  • Why doesn't Normal work?

    2 answers




enter image description here



I'm working through a coding exercise to program a matrix of Lissajour Curves in Mathematica but have encountered an obstacle when trying to recover the translated Point to then do further processing on them (as seen through the link). I've encountered problems trying to recovering the updated coordinates of translated points using Normal before. In this case I've gone so far as to try to rebuild that solution in my current notebook to no avail. It seems like there should be some application of Normal to Graphics[graphicsdata] that would generate the updated point coordinates in a list. I'm not sure what I'm missing about how Normal works but it would be useful to understand it as I try to advance my Mathematica program complexity.



angle = Drop[Range[0,Pi 2,(2 Pi)/20],-1];
cols = 5;
rows = 3;
radius = .45;

functionXY[anglevar_]:= {radius * Cos[anglevar],radius * Sin[anglevar]}

translatevectors = Flatten[{Table[{x,0},{x,cols}],Table[{0,-y},{y,rows}]},1];
points = Point /@ functionXY /@ angle;
graphicsdata = Table[Translate[#, translatevectors[[n]]] &/@ points,{n,Length@translatevectors}];
Graphics[graphicsdata]




Updated Dec 29 2018



I just thought it would be helpful to post the updated code here using the suggestions below should others find themselves in the postion of Normal not recovering translated coordinates as expected. In this case it is probably better to use TranslationTransform in the first place as now graphicsdata returns exactly the updated point's new coordinates that can be further post-processed.



elementaryPoints = functionXY /@ angle;
graphicsdata = Table[TranslationTransform[translatevectors[[n]]]@# &/@ elementaryPoints,{n,Length@translatevectors}];
Table[Point /@ graphicsdata[[n]],{n, Length@translatevectors}] // Graphics


enter image description here










share|improve this question











$endgroup$



marked as duplicate by Carl Woll list-manipulation
Users with the  list-manipulation badge can single-handedly close list-manipulation questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Dec 29 '18 at 21:26


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.















  • $begingroup$
    maybe normal = # /. Translate[(prim : Alternatives[Point, Line, Circle])[x_, y___], t_] :> prim[TranslationTransform[t]@x, y] &; normal@Graphics[graphicsdata]? `
    $endgroup$
    – kglr
    Dec 29 '18 at 3:39










  • $begingroup$
    I'm new to being able to close questions with one vote, so if you think this shouldn't be closed, just let me know.
    $endgroup$
    – Carl Woll
    Dec 29 '18 at 21:27










  • $begingroup$
    I'd suggest not closing it. I rarely see the overlap and it has two votes now anyways.
    $endgroup$
    – BBirdsell
    Dec 30 '18 at 1:51














2












2








2





$begingroup$



This question already has an answer here:




  • Why doesn't Normal work?

    2 answers




enter image description here



I'm working through a coding exercise to program a matrix of Lissajour Curves in Mathematica but have encountered an obstacle when trying to recover the translated Point to then do further processing on them (as seen through the link). I've encountered problems trying to recovering the updated coordinates of translated points using Normal before. In this case I've gone so far as to try to rebuild that solution in my current notebook to no avail. It seems like there should be some application of Normal to Graphics[graphicsdata] that would generate the updated point coordinates in a list. I'm not sure what I'm missing about how Normal works but it would be useful to understand it as I try to advance my Mathematica program complexity.



angle = Drop[Range[0,Pi 2,(2 Pi)/20],-1];
cols = 5;
rows = 3;
radius = .45;

functionXY[anglevar_]:= {radius * Cos[anglevar],radius * Sin[anglevar]}

translatevectors = Flatten[{Table[{x,0},{x,cols}],Table[{0,-y},{y,rows}]},1];
points = Point /@ functionXY /@ angle;
graphicsdata = Table[Translate[#, translatevectors[[n]]] &/@ points,{n,Length@translatevectors}];
Graphics[graphicsdata]




Updated Dec 29 2018



I just thought it would be helpful to post the updated code here using the suggestions below should others find themselves in the postion of Normal not recovering translated coordinates as expected. In this case it is probably better to use TranslationTransform in the first place as now graphicsdata returns exactly the updated point's new coordinates that can be further post-processed.



elementaryPoints = functionXY /@ angle;
graphicsdata = Table[TranslationTransform[translatevectors[[n]]]@# &/@ elementaryPoints,{n,Length@translatevectors}];
Table[Point /@ graphicsdata[[n]],{n, Length@translatevectors}] // Graphics


enter image description here










share|improve this question











$endgroup$





This question already has an answer here:




  • Why doesn't Normal work?

    2 answers




enter image description here



I'm working through a coding exercise to program a matrix of Lissajour Curves in Mathematica but have encountered an obstacle when trying to recover the translated Point to then do further processing on them (as seen through the link). I've encountered problems trying to recovering the updated coordinates of translated points using Normal before. In this case I've gone so far as to try to rebuild that solution in my current notebook to no avail. It seems like there should be some application of Normal to Graphics[graphicsdata] that would generate the updated point coordinates in a list. I'm not sure what I'm missing about how Normal works but it would be useful to understand it as I try to advance my Mathematica program complexity.



angle = Drop[Range[0,Pi 2,(2 Pi)/20],-1];
cols = 5;
rows = 3;
radius = .45;

functionXY[anglevar_]:= {radius * Cos[anglevar],radius * Sin[anglevar]}

translatevectors = Flatten[{Table[{x,0},{x,cols}],Table[{0,-y},{y,rows}]},1];
points = Point /@ functionXY /@ angle;
graphicsdata = Table[Translate[#, translatevectors[[n]]] &/@ points,{n,Length@translatevectors}];
Graphics[graphicsdata]




Updated Dec 29 2018



I just thought it would be helpful to post the updated code here using the suggestions below should others find themselves in the postion of Normal not recovering translated coordinates as expected. In this case it is probably better to use TranslationTransform in the first place as now graphicsdata returns exactly the updated point's new coordinates that can be further post-processed.



elementaryPoints = functionXY /@ angle;
graphicsdata = Table[TranslationTransform[translatevectors[[n]]]@# &/@ elementaryPoints,{n,Length@translatevectors}];
Table[Point /@ graphicsdata[[n]],{n, Length@translatevectors}] // Graphics


enter image description here





This question already has an answer here:




  • Why doesn't Normal work?

    2 answers








list-manipulation graphics geometry






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 29 '18 at 17:18







BBirdsell

















asked Dec 29 '18 at 3:14









BBirdsellBBirdsell

386313




386313




marked as duplicate by Carl Woll list-manipulation
Users with the  list-manipulation badge can single-handedly close list-manipulation questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Dec 29 '18 at 21:26


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.






marked as duplicate by Carl Woll list-manipulation
Users with the  list-manipulation badge can single-handedly close list-manipulation questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Dec 29 '18 at 21:26


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.














  • $begingroup$
    maybe normal = # /. Translate[(prim : Alternatives[Point, Line, Circle])[x_, y___], t_] :> prim[TranslationTransform[t]@x, y] &; normal@Graphics[graphicsdata]? `
    $endgroup$
    – kglr
    Dec 29 '18 at 3:39










  • $begingroup$
    I'm new to being able to close questions with one vote, so if you think this shouldn't be closed, just let me know.
    $endgroup$
    – Carl Woll
    Dec 29 '18 at 21:27










  • $begingroup$
    I'd suggest not closing it. I rarely see the overlap and it has two votes now anyways.
    $endgroup$
    – BBirdsell
    Dec 30 '18 at 1:51


















  • $begingroup$
    maybe normal = # /. Translate[(prim : Alternatives[Point, Line, Circle])[x_, y___], t_] :> prim[TranslationTransform[t]@x, y] &; normal@Graphics[graphicsdata]? `
    $endgroup$
    – kglr
    Dec 29 '18 at 3:39










  • $begingroup$
    I'm new to being able to close questions with one vote, so if you think this shouldn't be closed, just let me know.
    $endgroup$
    – Carl Woll
    Dec 29 '18 at 21:27










  • $begingroup$
    I'd suggest not closing it. I rarely see the overlap and it has two votes now anyways.
    $endgroup$
    – BBirdsell
    Dec 30 '18 at 1:51
















$begingroup$
maybe normal = # /. Translate[(prim : Alternatives[Point, Line, Circle])[x_, y___], t_] :> prim[TranslationTransform[t]@x, y] &; normal@Graphics[graphicsdata]? `
$endgroup$
– kglr
Dec 29 '18 at 3:39




$begingroup$
maybe normal = # /. Translate[(prim : Alternatives[Point, Line, Circle])[x_, y___], t_] :> prim[TranslationTransform[t]@x, y] &; normal@Graphics[graphicsdata]? `
$endgroup$
– kglr
Dec 29 '18 at 3:39












$begingroup$
I'm new to being able to close questions with one vote, so if you think this shouldn't be closed, just let me know.
$endgroup$
– Carl Woll
Dec 29 '18 at 21:27




$begingroup$
I'm new to being able to close questions with one vote, so if you think this shouldn't be closed, just let me know.
$endgroup$
– Carl Woll
Dec 29 '18 at 21:27












$begingroup$
I'd suggest not closing it. I rarely see the overlap and it has two votes now anyways.
$endgroup$
– BBirdsell
Dec 30 '18 at 1:51




$begingroup$
I'd suggest not closing it. I rarely see the overlap and it has two votes now anyways.
$endgroup$
– BBirdsell
Dec 30 '18 at 1:51










1 Answer
1






active

oldest

votes


















3












$begingroup$

As mentioned in the linked q/a, the section Properties and Relations in Scale, Translate and GeometricTransformation says:




When possible, Normal will transform the coordinates explicitly.




When Normal does not work, you can post-process the translated primitives to regular primitives with translated coordinates:



normal = # /. Translate[Point[x_], t_] :> Point[TranslationTransform[t]@x] &;
coords = Cases[normal@Graphics[graphicsdata], Point[x_] :> x, ∞];

Show[ListPlot[coords, AspectRatio -> Automatic, Axes -> False,
PlotStyle -> Directive[AbsolutePointSize[7], Opacity[.7, Red]]],
Graphics[graphicsdata]]


enter image description here






share|improve this answer











$endgroup$













  • $begingroup$
    Thanks; that all checks out wonderfully. I, of course, read that in the docs, but was puzzled as to what the exact conditions were when it is possible. Perhaps I should be rewriting this part of the code to use TranslationTransform instead of Translate?
    $endgroup$
    – BBirdsell
    Dec 29 '18 at 16:47




















1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









3












$begingroup$

As mentioned in the linked q/a, the section Properties and Relations in Scale, Translate and GeometricTransformation says:




When possible, Normal will transform the coordinates explicitly.




When Normal does not work, you can post-process the translated primitives to regular primitives with translated coordinates:



normal = # /. Translate[Point[x_], t_] :> Point[TranslationTransform[t]@x] &;
coords = Cases[normal@Graphics[graphicsdata], Point[x_] :> x, ∞];

Show[ListPlot[coords, AspectRatio -> Automatic, Axes -> False,
PlotStyle -> Directive[AbsolutePointSize[7], Opacity[.7, Red]]],
Graphics[graphicsdata]]


enter image description here






share|improve this answer











$endgroup$













  • $begingroup$
    Thanks; that all checks out wonderfully. I, of course, read that in the docs, but was puzzled as to what the exact conditions were when it is possible. Perhaps I should be rewriting this part of the code to use TranslationTransform instead of Translate?
    $endgroup$
    – BBirdsell
    Dec 29 '18 at 16:47


















3












$begingroup$

As mentioned in the linked q/a, the section Properties and Relations in Scale, Translate and GeometricTransformation says:




When possible, Normal will transform the coordinates explicitly.




When Normal does not work, you can post-process the translated primitives to regular primitives with translated coordinates:



normal = # /. Translate[Point[x_], t_] :> Point[TranslationTransform[t]@x] &;
coords = Cases[normal@Graphics[graphicsdata], Point[x_] :> x, ∞];

Show[ListPlot[coords, AspectRatio -> Automatic, Axes -> False,
PlotStyle -> Directive[AbsolutePointSize[7], Opacity[.7, Red]]],
Graphics[graphicsdata]]


enter image description here






share|improve this answer











$endgroup$













  • $begingroup$
    Thanks; that all checks out wonderfully. I, of course, read that in the docs, but was puzzled as to what the exact conditions were when it is possible. Perhaps I should be rewriting this part of the code to use TranslationTransform instead of Translate?
    $endgroup$
    – BBirdsell
    Dec 29 '18 at 16:47
















3












3








3





$begingroup$

As mentioned in the linked q/a, the section Properties and Relations in Scale, Translate and GeometricTransformation says:




When possible, Normal will transform the coordinates explicitly.




When Normal does not work, you can post-process the translated primitives to regular primitives with translated coordinates:



normal = # /. Translate[Point[x_], t_] :> Point[TranslationTransform[t]@x] &;
coords = Cases[normal@Graphics[graphicsdata], Point[x_] :> x, ∞];

Show[ListPlot[coords, AspectRatio -> Automatic, Axes -> False,
PlotStyle -> Directive[AbsolutePointSize[7], Opacity[.7, Red]]],
Graphics[graphicsdata]]


enter image description here






share|improve this answer











$endgroup$



As mentioned in the linked q/a, the section Properties and Relations in Scale, Translate and GeometricTransformation says:




When possible, Normal will transform the coordinates explicitly.




When Normal does not work, you can post-process the translated primitives to regular primitives with translated coordinates:



normal = # /. Translate[Point[x_], t_] :> Point[TranslationTransform[t]@x] &;
coords = Cases[normal@Graphics[graphicsdata], Point[x_] :> x, ∞];

Show[ListPlot[coords, AspectRatio -> Automatic, Axes -> False,
PlotStyle -> Directive[AbsolutePointSize[7], Opacity[.7, Red]]],
Graphics[graphicsdata]]


enter image description here







share|improve this answer














share|improve this answer



share|improve this answer








edited Dec 29 '18 at 22:42

























answered Dec 29 '18 at 5:21









kglrkglr

179k9198409




179k9198409












  • $begingroup$
    Thanks; that all checks out wonderfully. I, of course, read that in the docs, but was puzzled as to what the exact conditions were when it is possible. Perhaps I should be rewriting this part of the code to use TranslationTransform instead of Translate?
    $endgroup$
    – BBirdsell
    Dec 29 '18 at 16:47




















  • $begingroup$
    Thanks; that all checks out wonderfully. I, of course, read that in the docs, but was puzzled as to what the exact conditions were when it is possible. Perhaps I should be rewriting this part of the code to use TranslationTransform instead of Translate?
    $endgroup$
    – BBirdsell
    Dec 29 '18 at 16:47


















$begingroup$
Thanks; that all checks out wonderfully. I, of course, read that in the docs, but was puzzled as to what the exact conditions were when it is possible. Perhaps I should be rewriting this part of the code to use TranslationTransform instead of Translate?
$endgroup$
– BBirdsell
Dec 29 '18 at 16:47






$begingroup$
Thanks; that all checks out wonderfully. I, of course, read that in the docs, but was puzzled as to what the exact conditions were when it is possible. Perhaps I should be rewriting this part of the code to use TranslationTransform instead of Translate?
$endgroup$
– BBirdsell
Dec 29 '18 at 16:47





Popular posts from this blog

flock() on closed filehandle LOCK_FILE at /usr/bin/apt-mirror

Mangá

Eduardo VII do Reino Unido