Toward Optimistic Version Control in Architecture

Diffing, Patching, and Three-Way Merging for openNURBS 3D Models

Chapter 5
Demonstration

5.1 Diffing and Patching

The operation of the 3dmdiff, 3dmpatch, and 3dmdiff3 programs, along with their ability to work within the context of a Git repository, was demonstrated during the defense of this thesis on December 8, 2022. This demonstration began with an openNURBS model containing the tracing of Le Corbusier's Maison Dom-ino that was used to produce several illustrations in Chapter 2 (Figure 5.1). A copy of that file was created and subsequently modified so that two of the columns on the upper level were joined together to form a wall (Figure 5.2). The 3dmdiff utility was then used to reveal the differences between the two files with the command

3dmdiff domino.3dm domino_copy.3dm

which produced the following output:

--- domino.3dm 2022-12-08 11:29:15.385805 -0500
+++ domino_copy.3dm 2022-12-08 11:40:49.943148 -0500
@@ ~LineCurve 18ff88dd-01a4-47ff-96d6-0eaf02ef9484 @@
	Domain: [8.272019639391859, 8.606367521859378] -> [-2.6645352591003757e-15, 8.606367521859378]
	Geometry: transform(25.74075698852539, 0.0, 0.0, -229.1952667236328, 0.0, 25.74075698852539, 0.0, -632.5133056640625, 0.0, 0.0, 25.74075698852539, 0.0, 0.0, 0.0, 0.0, 1.0)
	StartPoint: (17.320573165521864, 28.592050881888326, 0.0) -> (17.32057316552188, 28.59205088188827, 0.0)
	EndPoint: (9.263874233629338, 25.565639766035588, 0.0) -> (9.26387423362934, 25.56563976603544, 0.0)
@@ -LineCurve 5ebba82c-b909-4313-8247-6fdc5c634031 @@
	Domain: [2.2551487856584056, 9.17534041976403]
	StartPoint: (9.966767623614944, 24.781772236940483, 0.0)
	EndPoint: (16.828909351701345, 23.887309741135965, 0.0)
@@ -LineCurve b07d85f3-efc1-4c07-be07-06211237b92e @@
	Domain: [0.0, 0.39375629476038715]
	StartPoint: (9.576868097848447, 25.68321249872336, 0.0)
	EndPoint: (9.966767623614944, 25.628236326880554, 0.0)
@@ -LineCurve c4427803-1bc0-4067-9240-464e2f3525b7 @@
	Domain: [2.7712785312946515, 10.277364432022416]
	StartPoint: (16.82890935170135, 28.407362730576203, 0.0)
	EndPoint: (16.82890935170135, 20.90127682984844, 0.0)
@@ -LineCurve 3b960de7-8cd5-4e90-a263-2be74deb736e @@
	Domain: [0.0, 5.920871468485612]
	StartPoint: (9.966767623614944, 25.628236326880554, 0.0)
	EndPoint: (9.966767623614944, 19.707364858394943, 0.0)
@@ -LineCurve 3c8bf58c-820a-4989-854a-656862c9f028 @@
	Domain: [4.7333498517256665, 10.777034288483303]
	StartPoint: (9.576868097848447, 25.68321249872336, 0.0)
	EndPoint: (9.576868097848447, 19.639528061965724, 0.0)
@@ -LineCurve 6d03ffd7-30e4-437d-9003-a608867ba401 @@
	Domain: [0.0, 0.5252075961518584]
	StartPoint: (17.32057316552188, 28.59205088188826, 0.0)
	EndPoint: (16.82890935170135, 28.407362730576203, 0.0)

The hunk beginning on the third line of the output describes the line that was extended to form the top of the wall. Its transformation matrix indicates that the line in Figure 5.2 is roughly 25.74 times longer than its counterpart in Figure 5.1. The StartPoint and EndPoint properties on lines 6 and 7 were not expected to be included in the delta since the transformation matrix fully describes the changes that were made to the line's geometry. Their appearance is due to floating-point rounding errors, which will be discussed in Section 6.2.

The other hunks in the delta correspond to lines that were removed from the model. Their domains and start and end points are listed in the delta so that the lines can be recreated in the event of a reverse patch.

The demonstration continued by re-running the 3dmdiff command, this time saving the output to a file:

3dmdiff domino.3dm domino_copy.3dm > domino_delta

Next, the modified copy of the Dom-ino tracing was deleted. It was then re-created by applying the saved delta to the original file using 3dmpatch:

3dmpatch -o domino_patched.3dm domino.3dm domino_delta

It would also have been possible to delete and re-create the original file using a reverse patch:

3dmpatch -R -o domino_revpatched.3dm domino_copy.3dm domino_delta

However, this functionality was not demonstrated during the defense.

Figure 5.1. The original tracing of Le Corbusier's Maison Dom-ino.
Figure 5.2. The modified copy of the Dom-ino tracing.

5.2 Merging via the Command Line

After diffing and patching had been demonstrated, another copy of file containing the Maison Dom-ino tracing was made. In this copy, the color of the lines that formed one of the columns was changed (Figure 5.3). A three-way diff between the two copies and the original file was then performed using the command

3dmdiff3 domino_copy.3dm domino.3dm domino_copy2.3dm

which produced the following delta combined the contents of the diff from Section 5.1 with the changes (lines 8–22 in the output below) necessary to describe the recolored column seen in Figure 5.3:

--- domino.3dm 2022-12-08 11:29:15.385805 -0500
+++ domino_copy.3dm 2022-12-08 11:40:49.943148 -0500
@@ ~LineCurve 18ff88dd-01a4-47ff-96d6-0eaf02ef9484 @@
	Domain: [8.272019639391859, 8.606367521859378] -> [-2.6645352591003757e-15, 8.606367521859378]
	Geometry: transform(25.74075698852539, 0.0, 0.0, -229.1952667236328, 0.0, 25.74075698852539, 0.0, -632.5133056640625, 0.0, 0.0, 25.74075698852539, 0.0, 0.0, 0.0, 0.0, 1.0)
	StartPoint: (17.320573165521864, 28.592050881888326, 0.0) -> (17.32057316552188, 28.59205088188827, 0.0)
	EndPoint: (9.263874233629338, 25.565639766035588, 0.0) -> (9.26387423362934, 25.56563976603544, 0.0)
@@ ~LineCurve 18f77ee6-89ec-4ac1-a11f-7281c559f9c5 @@
	Color: (0, 0, 0, 255) -> (255, 0, 0, 255)
	ColorSource: layer -> object
@@ ~LineCurve f097dad3-3fd6-4cdd-8209-4ac81a89b923 @@
	Color: (0, 0, 0, 255) -> (255, 0, 0, 255)
	ColorSource: layer -> object
@@ ~LineCurve b67d7103-9ebc-4ab5-8fae-d7909747dfd8 @@
	Color: (0, 0, 0, 255) -> (255, 0, 0, 255)
	ColorSource: layer -> object
@@ ~LineCurve 22fb014a-85bd-4a56-a0cd-07321aadd52e @@
	Color: (0, 0, 0, 255) -> (255, 0, 0, 255)
	ColorSource: layer -> object
@@ ~LineCurve 4fdbb6d3-2513-45dc-94a9-c9875077de85 @@
	Color: (0, 0, 0, 255) -> (255, 0, 0, 255)
	ColorSource: layer -> object
@@ -LineCurve 5ebba82c-b909-4313-8247-6fdc5c634031 @@
	Domain: [2.2551487856584056, 9.17534041976403]
	StartPoint: (9.966767623614944, 24.781772236940483, 0.0)
	EndPoint: (16.828909351701345, 23.887309741135965, 0.0)
@@ -LineCurve b07d85f3-efc1-4c07-be07-06211237b92e @@
	Domain: [0.0, 0.39375629476038715]
	StartPoint: (9.576868097848447, 25.68321249872336, 0.0)
	EndPoint: (9.966767623614944, 25.628236326880554, 0.0)
@@ -LineCurve c4427803-1bc0-4067-9240-464e2f3525b7 @@
	Domain: [2.7712785312946515, 10.277364432022416]
	StartPoint: (16.82890935170135, 28.407362730576203, 0.0)
	EndPoint: (16.82890935170135, 20.90127682984844, 0.0)
@@ -LineCurve 3b960de7-8cd5-4e90-a263-2be74deb736e @@
	Domain: [0.0, 5.920871468485612]
	StartPoint: (9.966767623614944, 25.628236326880554, 0.0)
	EndPoint: (9.966767623614944, 19.707364858394943, 0.0)
@@ -LineCurve 3c8bf58c-820a-4989-854a-656862c9f028 @@
	Domain: [4.7333498517256665, 10.777034288483303]
	StartPoint: (9.576868097848447, 25.68321249872336, 0.0)
	EndPoint: (9.576868097848447, 19.639528061965724, 0.0)
@@ -LineCurve 6d03ffd7-30e4-437d-9003-a608867ba401 @@
	Domain: [0.0, 0.5252075961518584]
	StartPoint: (17.32057316552188, 28.59205088188826, 0.0)
	EndPoint: (16.82890935170135, 28.407362730576203, 0.0)

Next, a merged openNURBS model (Figure 5.4) was produced by re-running the 3dmdiff command with the -m option:

3dmdiff3 -m -o delta_merged.3dm domino_copy.3dm domino.3dm domino_copy2.3dm
Figure 5.3. The second modified copy of the Dom-ino tracing.
Figure 5.4. The merged model containing the changes from Figures 5.2 and 5.3.

5.3 Merging via Sourcetree

Most computer users, and perhaps especially those accustomed to working visually like architects, are unlikely to be willing to contend with the tedium of a command line interface. Therefore, the final portion of the December 8 demonstration illustrated not only the integration of the openNURBS diff utilities with a Git repository but also how branching and merging of openNURBS models can be accomplished through a graphical user interface such as Atlassian's Sourcetree.

First, the original tracing of the Maison Dom-ino was copied into a repository that had already been set up according to the procedures described in Section 4.4. That file was then committed to the repository (Figure 5.5). Next, a new branch named alternate was created (Figure 5.6) and the version of the model on that branch was modified in the same way as Figure 5.2 (Figure 5.7). The repository was then switched back to the master branch, which restored the model to its original state. The model was again modified to resemble Figure 5.3 and those changes were committed directly to the master branch (Figure 5.8). Finally, the alternate branch was merged into the master branch to produce a model similar to Figure 5.4 (Figure 5.9).

Figure 5.5. Committing the Maison Dom-ino model to a Git repository in Sourcetree.
Figure 5.6. Creating a branch in Sourcetree.
Figure 5.7. The state of the repository after committing the first set of changes on the alternate branch.
Figure 5.8. The state of the repository after committing the second set of changes on the master branch.
Figure 5.9. The state of the repository after merging the alternate branch into the master branch.