offseting -- Offset or thicken surfaces¶
The functions here allow to move or extrude meshes along their normals
Note
Any offseting provided here only rely on the vertex and edge normals of the input meshes, so don't expect a nice result if your mesh is too chaotic to have meaningful normals
inflate_offsets(surface, offset, method='face')
¶
Displacements vectors for points of a surface we want to inflate.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
offset
|
float
|
the distance from the surface to the offset surface. Its meaning depends on |
required |
method
|
determines if the distance is from the old to the new faces, edges or points
possible values: |
'face'
|
Source code in madcad/offseting.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | |
inflate(surface, offset, method='face')
¶
Move all points of the surface to make a new one at a certain distance of the last one

Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
offset
|
float
|
the distance from the surface to the offseted surface. its meaning depends on |
required |
method
|
determines if the distance is from the old to the new faces, edges or points |
'face'
|
Examples:
>>> sphere = pierce(
... icosphere(O, 1),
... brick(min=vec3(0), max=vec3(2)) .flip(),
... )
>>> inflate(sphere, 0.1)
Source code in madcad/offseting.py
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | |
thicken(surface, thickness, alignment=0, method='face')
¶
Thicken a surface by extruding it, points displacements are made along normal.

Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
thickness
|
float
|
determines the distance between the two surfaces (can be negative to go the opposite direction to the normal). |
required |
alignment
|
float
|
specifies which side is the given surface: 0 is for the first, 1 for the second side, 0.5 thicken all apart the given surface. |
0
|
method
|
determines if the thickness is from the old to the new faces, edges or points |
'face'
|
Examples:
>>> sphere = pierce(
... icosphere(O, 1),
... brick(min=vec3(0), max=vec3(2)) .flip(),
... )
>>> thicken(sphere, 0.1)
Source code in madcad/offseting.py
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | |
expand(surface, offset, collapse=True)
¶
Generate a surface expanding the input mesh on the tangent of the ouline neighboring faces

Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
offset
|
float
|
distance from the outline point to the expanded outline points |
required |
collapse
|
if True, expanded points leading to crossing edges will collapse into one |
True
|
Examples:
>>> expand(
... revolution(wire([vec3(1,1,0), vec3(0,1,0)]), Axis(O,X), pi),
... 0.5)
Source code in madcad/offseting.py
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 | |