Create a copy of an object derived from the ConvexSet class.
Snew = S.copy
Snew = copy(S)
S |
Any object derived from the ConvexSet class, e.g. Polyhedron, YSet, ... Class: ConvexSet |
Snew |
New object which is an exact copy of the set S. Class: ConvexSet |
P=ExamplePoly.randVrep
Polyhedron in R^2 with representations: H-rep : Unknown (call computeHRep() to compute) V-rep (redundant) : Vertices 10 | Rays 0 Functions : noneCreate a new object Pnew that is a copy of the set P.
Pnew = P.copy
Polyhedron in R^2 with representations: H-rep : Unknown (call computeHRep() to compute) V-rep (redundant) : Vertices 10 | Rays 0 Functions : noneIf we do any change on the new polyhedron Pnew, this will not affect the original polyhedron. For instance, we can convert it to H-representation:
Pnew.H;
Pnew.hasHRep
ans = 1The original polyhedron P remains in V-representation
P.hasHRep
ans = 0The different story is when a new object is a reference of the original set. This is achieved by equality assignment:
Q = P;When the polyhedron Q is changed, this also affects the original polyhedron
Q.H;
Q.hasHRep
ans = 1
P.hasHRep
ans = 1
◀ | affinehull | plot | ▶ |
© 2003-2013 Michal Kvasnica: STU Bratislava, michal.kvasnica@stuba.sk
© 2010-2013 Martin Herceg: ETH Zurich, herceg@control.ee.ethz.ch