Below is a cutdown version of my Final Year Project from the University of Sussex where I studied Computer Science & Artificial Intelligence from 2001 to 2004. I have picked out the sections focused on the mathematics involved.
My 20yearold self apologises for any mistakes. Actually, he's probably moved on by now.
The result of the maths was a paperfolding demo which I made for the project. Have a play!
Huzita has formulated what is currently the most powerful known set of origami axioms:
Given two points p_{1} and p_{2} we can fold a line connecting them.
Given two points p_{1} and p_{2} we can fold p_{1} onto p_{2}.
Given two lines l_{1} and l_{2} we can fold line l_{1} onto l_{2}.
Given a point p_{1} and a line l_{1} we can make a fold perpendicular to l_{1} passing through the point p_{1}.
Given two points p_{1} and p_{2} and a line l_{1} we can make a fold that places p_{1} onto l_{1} and passes through the point p_{2}.
Given two points p_{1} and p_{2} and two lines l_{1} and l_{2} we can make a fold that places p_{1} onto line l_{1} and places p_{2} onto line l_{2}.
Each Axiom provides a method for folding the foldline. This is an extremely vital process of the system, as it enables various ways for users to create folds.
Only the first three Axioms may be necessary in Implementation, but the others can be used in possible extensions to the system.
The following are ideas I have come up with, whilst analysing and thinking about origami modelling. The idea of 'foldpoints' and 'foldlines' are original (although similar ideas will obviously appear elsewhere).
When thinking about ways to make a fold, you need points and lines (see Axioms). But how do you get these points and lines?
When you have the initial unfolded rectangular paper, you have 4 edges and 4 corner points. These make up the possible foldlines and foldpoints.
Foldlines are lines on the paper which can be folded along, or used to make other foldlines (using the axioms). Foldpoints are all the points which can be used in the axioms to create new foldlines.
Each time a fold is made; more foldpoints are created. These foldpoints are essentially all the intersections between the foldlines of a paper model.
Similarly, each time a fold is made; more foldlines are created.
In Figure 1 we have four foldpoints (1,2,3,4) and four edges (A,B,C,D) which can be used as foldlines. After folding point 1 we have Figure 2. We have gained two more foldpoints (5,6), changed one foldpoint (1), and gained three edges (E,F,G) for possible foldlines.
The foldline E in Figure 2, is the line which has been folded along. The foldpoint 1 in Figure 2, is the mirror of point 1 in Figure 1 on the line E. The other 2 gained foldlines F and G are again mirrors of sections of A and D.
We can create foldlines without making a fold as such, by making a crease. In the Figures above, if the fold was a crease then the result would be Figure 1, but with the added foldline E.
Using these foldpoints and foldlines we can create folds using the Origami Axioms (see here)
When you come to making consecutive folds, you need to extend the modelling and mathematics involved.
Not only will a paper model consist of Foldlines and Foldpoints, but it will be made up of layers. The notion of layers is necessary for multiple folds. For single folds, 1 layer becomes 2 layers. Just as with Foldlines and Foldpoints, every fold creates new Layers.
The addition of layers makes multiple folds possible, but introduces a number of problems. A layer is a twodimensional, flat, bounded, convex area (convex means there is no line that can be found by joining any 2 points inside the area which intersect an edge of the area) containing no folds (except for creases). Layers in a single model are connected by one or more of their edges to at least one other layer. This structure of connected layers forms the model of paper.
If we take the fold in Figure 2 from the previous section, then in a system with layers, it would produce 2 structures:
These 2 layers are connected by the edge E, which is in both layers.
When you have a set of Layers, making a fold becomes less straight forward. You have to fold all affected layers, and working out which layers are affected is a challenge. If the fold involves a foldline or foldpoint contained in the layer, then it is obviously affected, and must be folded.
Consider the Layers above. If the line 4→2 was folded on Layer 1 (using Axiom 1), then it is not immediately obvious if Layer 2 should be folded. It turns out that it is dependant on the direction of the fold. If the fold involves points 5 and 6 being folded over, and point 3 remaining stationary, then Layer 2 should be folded (in this case, the folding consists of reflecting the whole of Layer 2 on the line 4→2).
We could find this using the connected line E. If the fold on Layer 1 changes the line E, then it should be obvious that Layer 2 is affected.
As far as implementation is concerned, this can be achieved by an edge having a reference to all the Layers it is contained in.
It is important to note that the edge (and similarly a point) is not solely defined by its points, but the layers which it is used. This is because a model could contain 2 exact edges or points, but they could be on separate layers and not actually be the same connected edge/point. A simple example of this is when a square piece of paper is folded in half. Using this idea of an edge containing reference to its layers, it is possible to create a system whereby when a fold is made on a layer, all points and edges which are affected are used to find all affected layers, and then all points/lines in the affected layers are then checked.
This can be used to solve the problem with Example 2 in the following part.
In the above diagram, what should happen if we fold point 1 to either point 2 or 3? There are numerous possibilities, but the intuitive results are perhaps:
Example 1a  Example 1b  Example 2 
Example 1a is basically the same as unfolding the previous fold (creating a crease) and then refolding point 1, but this time on to point 2. This is clearly different from a normal fold between 2 points. Given a piece of real paper, this might be the more common response to being asked to fold point 1 on to point 2. However, Example 1b shows the result from an origami valleyfold and is the correct outcome, given that this is an origami system.
The result shown by Example 1a could be a possible extension option given to the user, if they wish to do this.
Example 2 appears to be a standard fold, but it has to limit the number of layers to fold. Only the top layer is folded, not the layer below, even though the foldline is inside the layer. This example also causes a problem with the idea of folding 'affected layers' which are found by connected edges. This idea needs to be adjusted to handle situations like example 2.
It could be modified so that each fold can be assigned layers. Normally all layers will be assigned, but in cases like this, a limited number of layers are to be folded (in this case, just 1). This means we can change the method of finding affected layers, to being layers connected to the affected points/edges, but only within the assigned layers. The system could assign all layers as default, but could be easily changed to assign only certain layers.
In order to implement layers, we must make the distinction between a coordinate and a point. Points will be in relation to a layer, and although 2 points might have the same coordinates, if they are on separate layers, then they are not the same point. Unless of course the point references both layers, and is therefore a connecting point between the 2 layers. The same applies to edges.
This section contains all the geometry needed for implementation of the system. All geometry calculations were worked out from scratch.
This is a basic introduction to the geometry of straightlines.
Gradient and yinterceptEquations of the form y = mx + c are called linear equations. When you plot values of these equations on a graph the points will lie on a straight line. This straight line has "yintercept" c and gradient m, where m = rise/step 
Parallel LinesTwo lines are said to be parallel when their gradients are equal. If two lines are parallel, then they do not ever intersect. 
Perpendicular LinesTwo lines are perpendicular if the product of their gradients is 1 To calculate the perpendicular gradient of a line it is 'minus the reciprocal' of the gradient: 1 / m 
Finding a MidPointThe midpoint between 2 other points can be calculated by taking the average of the x and y values.

Finding the Intersection of 2 LinesGiven 2 lines with equations
The intersection is when these 2 lines meet and therefore have equal values for x and y. It is therefore a simultaneous equation which we can solve.
We now have the x coordinate of the intersection. We can now substitute this x value in to either of the 2 lines to calculate the y value... y = L1.m * x + L1.c = L1.m ((L2.c  L1.c) / (L1.m  L2.m)) + L1.c 
Notation1.x and 1.y are the x and y coordinates of the point '1', respectively. A.m and A.c are the gradient and yintercept of the line 'A', respectively. (y = mx + c) A.1x, A.1y, A.2x, A.2y are the x & y coordinates of the 1st and 2nd points of the edge on the edgeline 'A'. 
Axiom 1: To find the foldline A from points 1 and 2Maths:
Explanation: First you find the gradient of line A. You do this by finding the 'Rise' (the difference in the Y values of the 2 points) and dividing it by the 'Step' (difference in X values). Now you have the gradient, you need to calculate the yintercept (where the line crosses the yaxis), otherwise we just know the slope of the line, but not its position. To find the yintercept (which is the value 'c' in the standard straightline equation y = mx + c) you simply need to use x and y values of one of the two points. We know the 'm' value (the gradient), and have an example y and x value, so we can use these to find 'c' by rearranging the equation to c = y  mx. 
Axiom 2: To find the foldline A from points 1 and 2Maths:
Explanation: The gradient of line B is found using the rise/step method above. The foldline A is perpendicular to line B, which means it is at rightangles with it. We calculate A's gradient with A.m = 1 / B.m (see above definition of Perpendicular). Again we now have the gradient of the foldline, but not the yintercept. Line A intercepts line B at the midpoint of Point 1 and 2 (as shown in the above diagram), therefore by finding this midpoint (Point 3) we can again substitute its x and y values to find the yintercept using c = y  mx. The midpoint of the 2 points is found by calculating the mean x and y values. 
Axiom 3: To find the foldline C from edgelines A and BMaths: (note: n is the length of 1→2 and 1→4 chosen. This value is not important.)
Explanation: If edges A and B are parallel then Figure D is used (see below). This means that for this method the 2 lines (upon which the 2 edges lie) intersect at some Point (Point 1). This point can be solved using the simultaneous equation method shown in the above section 'Finding the Intersection of 2 Lines' (in Straight Line Geometry). Now we have the intersection (Point 1) we can find Points 2 and 4, which lie on lines A and B respectively. Both points are equidistant from Point 1. The distance (which is 'n' for the sake of the calculations) is not important; any nonzero value can be used as long as they are equal. Using Pythagoras' theorem we know that
However we are trying to find the Point 4. The gradient of the Line B is (using rise / step) B.m = (4.y  1.y) / (4.x  1.x) So we can say that
Therefore, going back to the Pythagoras' theorem equation
Now we have the x coordinate of Point 4, we can simply substitute it in to the equation of Line B to produce the y coordinate... 4.y = B.m * 4.x + B.c The exact same method is used to find Point 2, but using Line A instead of B. Now we have Point 2 and Point 4. Point 3 is simply the midpoint of these 2 points (see the above section on finding midpoints in Straight Line Geometry). The ultimate foldline C is the line which passes through point 3 and is perpendicular to the line joining points 2 and 4 (Line D). To calculate the gradient of D we use the 'rise / step' method with points 2 and 4, and therefore the gradient of Line C is C.m = 1 / D.m = (2.x  4.x) / (2.y  4.y) Again, to find the yintercept of C, we substitute the x and y values of Point 3 in to the linear equation to produce
We now have the foldline. y = C.m * x + C.c 
Axiom 3 (when parallel): To find the foldline C from edgelines A and B when they are parallelMaths:
Explanation: The edges are parallel and therefore there is no intersection. However, this makes it a lot more simple. The foldline C has the same gradient as both Line A and B, and passes through the midpoint of any point on line A and any on line B (Point 1). We use the coordinates of the 1st endpoint in both edges. The midpoint between any point on the 2 edges always lies on line C, as it is always equidistant from both lines. Once Point 1 is calculated, the yintercept of C is found by again substituting the x and y values of Point 1 in to the linear equation of C...

When folding a layer on the foldline, there are 2 possible outcomes as a foldline doesn't specify the direction of the fold. If the foldline bisects the layer then which section is folded (reflected)? Similarly, if the foldline doesn't bisect the layer then should the layer remain the same or be reflected?
It is decided by the foldpoint. This is the point which is moved, thereby creating a fold. By calculating which 'side' of the foldline this foldpoint is, we can determine which points, edges and layers should be reflected, as the foldpoint is always reflected.
Point P and Line L (y = mx + c)By creating a line with the same gradient as L, which passes through P (as shown in the diagram), we can compare the yintercept values to show whether point P is 'below' the line L. To find this new line, L2...
We then compare L.c to L2.c to find which side of the line P lies. 
Point P and Line L (x = c)If the Line is of the form x = c (e.g. n = 0) then the x value of the Point (P.x) can be compared to the c value of the Line (L.c) to determine the 'side'. In this case when the point is on the 'left' of the line, it is classed as being 'below' (as its value is less). 
Edge E (P1→P2) and Line L (y = mx + c)This works in the same way as finding the Point and Line y = mx + c, except that we work out the yintercept for each of the 2 points on the edge E (P1 and P2), so that...
We then find the maximum value of these 2 yintercepts and compare it to L.c. This way, only edges fully beneath the line are counted as being 'below'. It is possible that 1 point is above and the other below the line (and in this case the edge would be classed as being above the line), however this will not occur in the system because the line L is always a foldline and therefore any edge which is intersected by it, is bisected to produce 2 edges, one above and the other below. 
Edge E (P1→P2) and Line L (x = c)If the Line is of the form x = c (e.g. n = 0) then the maximum x value of the Points P1 and P2 (e.g. Max(P1.x,P2.x)) can be compared to the c value of the Line (L.c) to determine the 'side'. When the point is on the 'left' of the line, it is classed as being 'below' (as its value is less). 
Layer and LineA layer is only classed as being 'below' a line if all of its edges are below. We can therefore simply use the method for finding if an edge is below a line and repeat it for all edges on the layer. Again it is possible that some edges are above and some are below, meaning the line intersects the layer, however in this case the layer would be folded and all its edges reflected to be 1 side of the line. 
Given an edge (E), we find the gradient using its 2 points (E.P1 and E.P2) and the rise / step method  which also gives us the gradient of the line L...
We then find the yintercept of L by substituting one of the edge's points (e.g. E.P1)

Given a line (L) and a layer, we produce an edge for the section of the line which is contained in the layer (as shown in the diagram). If all the edges from the layer are taken, and for each one which intersections with the line L, the intersection is found. The number of unique intersection points will always be 0 (for when the line doesn't intersect the layer at all  therefore producing no edge) or 2 (this is because Layers are always convex  so more than 2 is not possible). When there are 2 intersection points (P1 and P2), the 2 points form the edge P1→P2. 
Given the line L with equation y = L.m * x + L.c we know that if the point P lies on L then
We calculate the above and compare to the actual values of P. To account for horizontal and vertical lines we calculate both of the above, and if either are equal then P lies on L. 
Convert the edge E to a line (see here) and then check if P lies on the line (see here). Assuming that P lies on the line, we now need to find if point P is in the bounding box of E. P.x must be between E.P1.x and E.P2.x and P.y must be between E.P1.y and E.P2.y. If P lies on the line created from E, and it lies inside the bounding box of E, then it lies on the edge E. 
Given a point, we need to calculate the shortest distance to a particular line, edge or another point.
Distance from Point to PointTo find the shortest distance between P1 and P2 (d) we use Pythagoras' theorem to show that
Therefore

Distance from Point to LineTo find the shortest distance between point P and line L, we first have to find L2, the line perpendicular to L which passes through P.
Now we have L2, we find the point P2, the intersection of L and L2. We use the method discussed earlier for finding the intersection of 2 lines. We then use the above method for finding the distance from Point to Point, to find the distance from P to P2. 
Distance from Point to EdgeTo find the shortest distance between point P and edge E, we first convert the Edge to a Line (using the previously discussed method) and use the above method for finding the distance from a point to a line. If point P2 (in the previous diagram) lies on the edge E, then the distance from P and P2 in the previous method is the shortest distance from P to E. However, if it does not lie on the edge then we calculate the distance between P and E's 2 Points (E.P1 and E.P2) and take the minimum distance to be the shortest distance between P and E. 
When a fold takes place, points are reflected on the foldline.
Reflecting a Point (P) on a Line (L)To find the reflection of P on L, we find the line L2, which is the line perpendicular to L, passing through P.
We then find point P2, which is the intersection of lines L and L2 using the method discussed earlier. Point P2 is the midpoint of P and P3 (the reflection point). We can therefore use the midpoint method to show:
Therefore

Reflecting an Edge (E) on a Line (L)Both points of the edge E (E.P1 and E.P2) are reflected by L using the above method. 
Reflecting a Layer on a Line (L)All edges in the layer are reflected as above. 
P1~P2 = the distance between
point P1 and P2
P1.P4.P3 = the angle between
these 3 points
To find the angle created by 3 points (as if a triangle is formed by the 3 points, as shown below). This can be used to find the angle between 2 joined edges (if P1→P2 and P2→P3 are the 2 edges for the example below).
The angle between the points P1, P2 and P3 (P1.P2.P3) is shown as α on the diagram.
Using the Cosine law (shown on the right): (P1~P3)² = (P1~P2)² + (P2~P3)²  2 * (P1~P2) * (P2~P3) Cos (P1.P2.P3) By rearranging the 3rd Cosine Law equation, we get... 
L and L2 intersect at point P and have the angle A between them. 
Using Trigonometry on a rightangled triangle, we can find the angle n. For example:
The gradient of the line along the hypotenuse (h) is given (using the rise / step method) by a / o, which is the reciprocal of o / a. 
Therefore, using the above trigonometry, the angle B can be found as follows:
Similarly:
Therefore, to find the gradient of L2:
Therefore, L2 is the line which passes through point P, and has gradient: We then find the yintercept, L2.c, by substituting P's x and y values to give
Therefore

Points P1 and P2 both lie on line L. Given line L and point P1, and P1~P2 (the distance between P1 and P2), we need to calculate P2. A positive distance indicates that P2 lies to the right of P1, whereas a negative value means that it is to the left. 
We can see from the diagram that
We know that the gradient of line L is found using the rise / step method, so therefore
We also know from Pythagoras' theorem that
We need to therefore calculate a in terms of L.m and c (which are known).
Now we have a, we can find the yvalue of P2
And because P2 lies on L, we can find the xvalue of P2 using L's equation

P1 → P4 = the edge between point P1 and P4
A valley fold is produced by folding the paper along a line towards the folder (above the point's current layer).
The foldline is found from the Points/Edges (see Finding the FoldLine) given by the user.
Layers:Folding P1 to P5 produces the foldline L1 (see Finding the FoldLine). 
Layers:P6 = The intersection of P1→P2 and L1 P7 = The intersection of P1→P4 and L1 
Mountain folds can be produced using Valley folds and flipping.
P1 → P4 = the edge between point P1 and P4
P1.P4.P3 = the angle between these 3 points
(in the diagram below, this angle is 90°)
A squash fold is a complex fold type which requires multiple methods (all discussed earlier). See here for details on the squash fold.
To perform a Squash fold a crease must be chosen and then a Point moved. In the example diagrams below, the crease is P4→P3 and the corner at P1 is folded to P5. The following conditions for point and crease must be met for it to be possible to make a squash fold.
Layers:If the conditions are met, then we move the chosen point (P1 in this case) to a new location (P5). The only restriction on P5 is that P4→P5 has the same length as P1→P4. 
Layers:P6 = Intersection of Layer2 and the line from P4 with angle P6.P4.P3 = (P1.P4.P3  P3.P4.P5) / 2 towards P1 (which is why the angle is negated). P7 = Intersection of Layer2 and the line from P4 with angle (P1.P4.P3 + P3.P4.P5) / 2 But then reflected on P4→P3, giving P7.P4.P3 = (P1.P4.P3 + P3.P4.P5) / 2 This produces the diagram shown right, with layers 1 to 4 (where 1 is topmost). 