Skip to Content.
Sympa Menu

cgal-discuss - [cgal-discuss] is the command pattern the only way to do undo/redo

Subject: CGAL users discussion list

List archive

[cgal-discuss] is the command pattern the only way to do undo/redo


Chronological Thread 
  • From: "Shi Yan" <>
  • To:
  • Subject: [cgal-discuss] is the command pattern the only way to do undo/redo
  • Date: Mon, 30 Jun 2008 22:33:57 -0700
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type :content-transfer-encoding:content-disposition; b=IlhyjAOLFqZt7iLcHSfa0DRTtfr3n6OjDzXyWFJzIXjSc03DTKaRDam2NHdIqdNYAp pLR03dsSbQAFCFRGwz7G0R7N9jhoRaq7mr+hVKQ+9RqdkldFeJutY4QzoJGfD2Y94N9I bU6gbUG3NH4FtqDSZqyCU1rGz42w/YtM0rNeQ=

hello folks,

did you have any experience of writing a half-edge data structure with
undo/redo feature?

i'm wondering if the command pattern is the only way to achieve undo and redo.

the command pattern packs each operation and its parameters as a
command and pushes the commands into a stack as executing them.

once the user needs to restore the data, the commands will be popped
up and executed in backwards.

aside from the function parameters, i also need to pack the half-edge
handle on which the operation is applied with the command.

however after some operations, the half-edge handle could be invalid.
for example:

suppose i have an edge E with endpoints A and B A
<--------E--------- B

the half-edge handle E points to A.

now i want to move A a little bit. so i create a "move command" which
contains the half-edge handle E pointing to A.

and then, i split this E in to two edges by a "split command"
A<---------K<------------B


now suppose i want to restore all my previous operations.

i first reconstruct the edge BA by connecting KA and BK :
A <-------------U-------------- B

and now i need to move point A back to the original position, but i
cannot do it, because i lost the half-edge handle E.

so how i'm suppose to do this?

thank you.



Archive powered by MHonArc 2.6.16.

Top of Page