Problem 1785. Dilate a 3d object sampled on a regular grid
3d objects can be described by a set of points on a regular grid in Euclidean space. Given the n x 3 matrix m defining some number of objects on a grid with resolution res, return a matrix p that defines these objects after dilation by a single point on the grid in every direction.
Assume an "edge" connectivity scheme for dilation (i.e. each point in the grid has 18 neighbors, one for each surface of a cube and one for each edge of the cube). Any given point should appear in the output matrix once.
m = [0 0 0]; res = 1; >> p = dilate3d(m,res)
p =
-1 -1 0 -1 0 -1 -1 0 0 -1 0 1 -1 1 0 0 -1 -1 0 -1 0 0 -1 1 0 0 -1 0 0 0 0 0 1 0 1 -1 0 1 0 0 1 1 1 -1 0 1 0 -1 1 0 0 1 0 1 1 1 0
Solution Stats
Problem Comments
Solution Comments
Show commentsProblem Recent Solvers7
Suggested Problems
-
2068 Solvers
-
154 Solvers
-
Implement simple rotation cypher
1085 Solvers
-
Find third Side of a right triangle given hypotenuse and a side. No * - or other functions allowed
245 Solvers
-
31 Solvers
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!