How to use Normal to recover translated points [duplicate]
$begingroup$
This question already has an answer here:
Why doesn't Normal work?
2 answers
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
list-manipulation graphics geometry
$endgroup$
marked as duplicate by Carl Woll
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.
add a comment |
$begingroup$
This question already has an answer here:
Why doesn't Normal work?
2 answers
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
list-manipulation graphics geometry
$endgroup$
marked as duplicate by Carl Woll
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$
maybenormal = # /. 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
add a comment |
$begingroup$
This question already has an answer here:
Why doesn't Normal work?
2 answers
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
list-manipulation graphics geometry
$endgroup$
This question already has an answer here:
Why doesn't Normal work?
2 answers
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
This question already has an answer here:
Why doesn't Normal work?
2 answers
list-manipulation graphics geometry
list-manipulation graphics geometry
edited Dec 29 '18 at 17:18
BBirdsell
asked Dec 29 '18 at 3:14
BBirdsellBBirdsell
386313
386313
marked as duplicate by Carl Woll
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
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$
maybenormal = # /. 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
add a comment |
$begingroup$
maybenormal = # /. 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
add a comment |
1 Answer
1
active
oldest
votes
$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]]
$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 useTranslationTransform
instead ofTranslate
?
$endgroup$
– BBirdsell
Dec 29 '18 at 16:47
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
$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]]
$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 useTranslationTransform
instead ofTranslate
?
$endgroup$
– BBirdsell
Dec 29 '18 at 16:47
add a comment |
$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]]
$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 useTranslationTransform
instead ofTranslate
?
$endgroup$
– BBirdsell
Dec 29 '18 at 16:47
add a comment |
$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]]
$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]]
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 useTranslationTransform
instead ofTranslate
?
$endgroup$
– BBirdsell
Dec 29 '18 at 16:47
add a comment |
$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 useTranslationTransform
instead ofTranslate
?
$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
add a comment |
$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