Difference between revisions of "AttachCopyToView Command"

From GeoGebra Manual
Jump to: navigation, search
m (typo)
(command syntax: changed [ ] into ( ))
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<noinclude>{{Manual Page|version=4.2}}</noinclude>
+
<noinclude>{{Manual Page|version=5.0}}</noinclude>{{command|scripting}}
{{command|scripting}}
+
;AttachCopyToView( <Object>, <View 0|1|2> )
;AttachCopyToView[ <Object>, <View 0|1|2> ]
+
:If ''View = 0'', a copy of given object is created. For ''View = 1'' or ''View = 2'' this command creates a dependent copy of given object whose size in given [[File: Menu view graphics.svg|link=|16px]] [[Graphics View]] is constant.
:If ''View = 0'', a copy of given object is created. For ''View = 1'' or ''View = 2'' this command creates a dependent copy of given object whose size in given [[Graphics View]] is constant.
+
:{{Example|1=<div>Let <code><nowiki>poly = Polygon((0, 0), (1, 0), (1, 1), (0, 1))</nowiki></code>. <br> If Graphics View 1 is active, <code><nowiki>AttachCopyToView(poly, 1)</nowiki></code> creates a square with the same size at the same position.</div>}}
:{{Example|1=<div>Let <code><nowiki>poly = Polygon[(0, 0), (1, 0), (1, 1), (0, 1)]</nowiki></code>. <br> If Graphics View 1 is active, <code><nowiki>AttachCopyToView[poly, 1]</nowiki></code> creates a square with the same size at the same position.</div>}}
 
 
:{{Note|Once the copy is created, three other arguments are added to the command definition.}}
 
:{{Note|Once the copy is created, three other arguments are added to the command definition.}}
;AttachCopyToView[ <Object>, <View 0|1|2>, <Point 1>, <Point 2>, <Screen Point 1>, <Screen Point 2> ]
+
;AttachCopyToView( <Object>, <View 0|1|2>, <Point 1>, <Point 2>, <Screen Point 1>, <Screen Point 2> )
:If ''View = 0'', a copy of given object is created. For ''View = 1'' or ''View = 2'' this command creates a dependent copy of given object whose size in given [[Graphics View]] is transformed using the affine transform that maps ''Point 1'' to a point whose screen coordinates (in pixels) are equal to ''Screen Point 1'', and ''Point 2'' to a point with screen coordinates equal to ''Screen Point 2''.
+
:If ''View = 0'', a copy of given object is created. For ''View = 1'' or ''View = 2'' this command creates a dependent copy of given object whose size in given [[File: Menu view graphics.svg|link=|16px]] [[Graphics View]] is transformed using the affine transform that maps ''Point 1'' to a point whose screen coordinates (in pixels) are equal to ''Screen Point 1'', and ''Point 2'' to a point with screen coordinates equal to ''Screen Point 2''.
:{{Example|1=<div>Let <code><nowiki>poly = Polygon[(0, 0), (1, 0), (1, 1), (0, 1)]</nowiki></code>. <br> If Graphics View 1 is active, <code><nowiki>AttachCopyToView[poly, 1, (0, 0), (1, 1), (0, 0), (100, 100)]</nowiki></code> creates a ''100px x 100px'' square in the top left corner of the Graphics View.</div>}}
+
:{{Example|1=<div>Let <code><nowiki>poly = Polygon((0, 0), (1, 0), (1, 1), (0, 1))</nowiki></code>. <br> If Graphics View 1 is active, <code><nowiki>AttachCopyToView(poly, 1, (0, 0), (1, 1), (0, 0), (100, 100))</nowiki></code> creates a ''100px x 100px'' square in the top left corner of the Graphics View.</div>}}
 +
:{{note|1=All points of the object are copied, even if they lie outside the view.}}

Latest revision as of 08:52, 12 October 2017


AttachCopyToView( <Object>, <View 0|1|2> )
If View = 0, a copy of given object is created. For View = 1 or View = 2 this command creates a dependent copy of given object whose size in given Menu view graphics.svg Graphics View is constant.
Example:
Let poly = Polygon((0, 0), (1, 0), (1, 1), (0, 1)).
If Graphics View 1 is active, AttachCopyToView(poly, 1) creates a square with the same size at the same position.
Note: Once the copy is created, three other arguments are added to the command definition.
AttachCopyToView( <Object>, <View 0|1|2>, <Point 1>, <Point 2>, <Screen Point 1>, <Screen Point 2> )
If View = 0, a copy of given object is created. For View = 1 or View = 2 this command creates a dependent copy of given object whose size in given Menu view graphics.svg Graphics View is transformed using the affine transform that maps Point 1 to a point whose screen coordinates (in pixels) are equal to Screen Point 1, and Point 2 to a point with screen coordinates equal to Screen Point 2.
Example:
Let poly = Polygon((0, 0), (1, 0), (1, 1), (0, 1)).
If Graphics View 1 is active, AttachCopyToView(poly, 1, (0, 0), (1, 1), (0, 0), (100, 100)) creates a 100px x 100px square in the top left corner of the Graphics View.
Note: All points of the object are copied, even if they lie outside the view.

Comments

Note: All parts of <object> are mapped, even if some parts of <object> lie outside the rectangle defined by Corner 1 and Corner 3.


© 2024 International GeoGebra Institute