@@ -113,24 +113,21 @@ pub struct Point {
113113#[ ts( export, export_to = "FrontendApi.ts" ) ]
114114pub enum Freedom {
115115 Free ,
116- Partial ,
117116 Fixed ,
117+ Conflict ,
118118}
119119
120120impl Freedom {
121+ /// Merges two Freedom values. For example, a point has a solver variable
122+ /// for each dimension, x and y. If one dimension is `Free` and the other is
123+ /// `Fixed`, the point overall is `Free` since it isn't fully constrained.
124+ /// `Conflict` infects the most, followed by `Free`. An object must be fully
125+ /// `Fixed` to be `Fixed` overall.
121126 pub fn merge ( self , other : Self ) -> Self {
122- match self {
123- Self :: Free => match other {
124- Self :: Free => Self :: Free ,
125- Self :: Partial => Self :: Partial ,
126- Self :: Fixed => Self :: Partial ,
127- } ,
128- Self :: Partial => Self :: Partial ,
129- Self :: Fixed => match other {
130- Self :: Free => Self :: Partial ,
131- Self :: Partial => Self :: Partial ,
132- Self :: Fixed => Self :: Fixed ,
133- } ,
127+ match ( self , other) {
128+ ( Self :: Conflict , _) | ( _, Self :: Conflict ) => Self :: Conflict ,
129+ ( Self :: Free , _) | ( _, Self :: Free ) => Self :: Free ,
130+ ( Self :: Fixed , Self :: Fixed ) => Self :: Fixed ,
134131 }
135132 }
136133}
0 commit comments