How to use Normal to recover translated points [duplicate]
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
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();
}
);
});
});
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.
add a comment |
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
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();
}
);
});
});
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.
maybenormal = # /. 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
add a comment |
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
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 2 days ago
asked Dec 29 '18 at 3:14
BBirdsell
379313
379313
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();
}
);
});
});
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
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.
maybenormal = # /. 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
add a comment |
maybenormal = # /. 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
add a comment |
1 Answer
1
active
oldest
votes
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]]
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
?
– BBirdsell
2 days ago
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
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]]
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
?
– BBirdsell
2 days ago
add a comment |
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]]
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
?
– BBirdsell
2 days ago
add a comment |
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]]
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 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 useTranslationTransform
instead ofTranslate
?
– BBirdsell
2 days ago
add a comment |
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
?
– 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
add a comment |
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