@@ -195,10 +195,13 @@ function rotateZ(pt3D::Point3D, rad)
195
195
return Point3D (x, y, pt3D. z)
196
196
end
197
197
198
+ # rotate around axes
199
+
198
200
"""
199
201
rotateby(pt::Point3D, angleX, angleY, angleZ)
202
+ rotateby(ptlist::Array{Point3D, 1}, angleX, angleY, angleZ)
200
203
201
- Return a new point resulting from rotating the specified point
204
+ Return a new point/list of points resulting from rotating
202
205
around the x, y, and z axes by angleX, angleY, angleZ.
203
206
"""
204
207
function rotateby (pt:: Point3D , angleX, angleY, angleZ)
@@ -208,10 +211,30 @@ function rotateby(pt::Point3D, angleX, angleY, angleZ)
208
211
return v
209
212
end
210
213
214
+ function rotateby (ptlist:: Array{Point3D, 1} , angleX, angleY, angleZ)
215
+ return rotateby .(ptlist, angleX, angleY, angleZ)
216
+ end
217
+
218
+ """
219
+ rotateby!(ptlist::Array{Point3D, 1}, angleX, angleY, angleZ)
220
+
221
+ Return the list of points with each one rotated
222
+ around the x, y, and z axes by angleX, angleY, angleZ.
223
+ """
224
+ function rotateby! (ptlist:: Array{Point3D, 1} , angleX, angleY, angleZ)
225
+ for i in eachindex (ptlist)
226
+ ptlist[i] = rotateby (ptlist[i], angleX, angleY, angleZ)
227
+ end
228
+ return ptlist
229
+ end
230
+
231
+ # rotate around point
232
+
211
233
"""
212
234
rotateby(newpt::Point3D, existingpt::Point3D, angleX, angleY, angleZ)
213
235
214
- Return a new point resulting from rotating the point by angleX, angleY, angleZ around another point.
236
+ Return a new point/list resulting from rotating each point
237
+ by angleX, angleY, angleZ around another point.
215
238
"""
216
239
function rotateby (newpt:: Point3D , existingpt:: Point3D , angleX, angleY, angleZ)
217
240
v = newpt - existingpt
@@ -222,15 +245,29 @@ function rotateby(newpt::Point3D, existingpt::Point3D, angleX, angleY, angleZ)
222
245
end
223
246
224
247
"""
225
- setposition!(ptlist::Point3D, pt::Point3D)
248
+ rotateby!(ptlist::Point3D, existingpt::Point3D, angleX, angleY, angleZ)
249
+
250
+ Rotate each point in the list by angleX, angleY, angleZ around another point.
251
+ """
252
+ function rotateby! (ptlist:: Array{Point3D, 1} , existingpt:: Point3D , angleX, angleY, angleZ)
253
+ for i in eachindex (ptlist)
254
+ ptlist[i] = rotateby (ptlist[i], existingpt, angleX, angleY, angleZ)
255
+ end
256
+ return ptlist
257
+ end
226
258
227
- Move points by a vector..
259
+ """
260
+ moveby!(ptlist::Point3D, x, y, z)
261
+ moveby!(ptlist::Point3D, pt::Point3D)
228
262
263
+ Move all points in the list by a vector.
229
264
"""
230
- function setposition ! (ptlist:: Array{Point3D, 1} , pt:: Point3D )
231
- return ( + ) . ( ptlist, pt)
265
+ function moveby ! (ptlist:: Array{Point3D, 1} , pt:: Point3D )
266
+ return ptlist .+ = pt
232
267
end
233
268
269
+ moveby! (ptlist:: Array{Point3D, 1} , x, y, z) = moveby! (ptlist, Point3D (x, y, z))
270
+
234
271
"""
235
272
surfacenormal(ptlist)
236
273
0 commit comments