How to use Normal to recover translated points [duplicate]












2















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















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();
}
);
});
});
2 days ago


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.















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










  • 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.
    – Carl Woll
    2 days ago










  • I'd suggest not closing it. I rarely see the overlap and it has two votes now anyways.
    – BBirdsell
    2 days ago
















2















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















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();
}
);
});
});
2 days ago


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.















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










  • 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.
    – Carl Woll
    2 days ago










  • I'd suggest not closing it. I rarely see the overlap and it has two votes now anyways.
    – BBirdsell
    2 days ago














2












2








2








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
















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 2 days ago

























asked Dec 29 '18 at 3:14









BBirdsell

379313




379313




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();
}
);
});
});
2 days ago


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();
}
);
});
});
2 days ago


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.














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










  • 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.
    – Carl Woll
    2 days ago










  • I'd suggest not closing it. I rarely see the overlap and it has two votes now anyways.
    – BBirdsell
    2 days ago


















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










  • 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.
    – Carl Woll
    2 days ago










  • I'd suggest not closing it. I rarely see the overlap and it has two votes now anyways.
    – BBirdsell
    2 days ago
















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




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












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.
– Carl Woll
2 days ago




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.
– Carl Woll
2 days ago












I'd suggest not closing it. I rarely see the overlap and it has two votes now anyways.
– BBirdsell
2 days ago




I'd suggest not closing it. I rarely see the overlap and it has two votes now anyways.
– BBirdsell
2 days ago










1 Answer
1






active

oldest

votes


















3














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























  • 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?
    – BBirdsell
    2 days ago




















1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









3














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























  • 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?
    – BBirdsell
    2 days ago


















3














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























  • 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?
    – BBirdsell
    2 days ago
















3












3








3






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














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 2 days ago

























answered Dec 29 '18 at 5:21









kglr

177k9198404




177k9198404












  • 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?
    – BBirdsell
    2 days ago




















  • 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?
    – BBirdsell
    2 days ago


















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?
– BBirdsell
2 days ago






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?
– BBirdsell
2 days ago





Popular posts from this blog

"Incorrect syntax near the keyword 'ON'. (on update cascade, on delete cascade,)

Alcedinidae

Origin of the phrase “under your belt”?