Calculate “Volume” and “Surface Area” of a voxel-based sphere
$begingroup$
By "voxel-based sphere" I mean a sphere made up of cubes. Sorry if that is not the correct terminology. Imagine a sphere made out of legos. Except each voxel is a cube (unlike most legos). Determining the voxel distribution to make the sphere I suppose would involve calculating the x/y/z of a position on the sphere and then 'snapping' it to the nearest multiple of the voxel width/height.
Here's a calculator that can generate one:
http://neil.fraser.name/news/2006/11/17/
And here is an image of one (cross sectioned):
Given the diameter of this voxel sphere (in number of voxels, e.g. '20 voxels in diameter'), how can I calculate:
- The number of voxels in the sphere if it were hollow (kind of a 'surface area')
- The number of voxels in the sphere if it were solid (kind of a 'volume')
Is there a formula possible here? :)
geometry
$endgroup$
add a comment |
$begingroup$
By "voxel-based sphere" I mean a sphere made up of cubes. Sorry if that is not the correct terminology. Imagine a sphere made out of legos. Except each voxel is a cube (unlike most legos). Determining the voxel distribution to make the sphere I suppose would involve calculating the x/y/z of a position on the sphere and then 'snapping' it to the nearest multiple of the voxel width/height.
Here's a calculator that can generate one:
http://neil.fraser.name/news/2006/11/17/
And here is an image of one (cross sectioned):
Given the diameter of this voxel sphere (in number of voxels, e.g. '20 voxels in diameter'), how can I calculate:
- The number of voxels in the sphere if it were hollow (kind of a 'surface area')
- The number of voxels in the sphere if it were solid (kind of a 'volume')
Is there a formula possible here? :)
geometry
$endgroup$
1
$begingroup$
Decompose it into cross sections; each segment should allow an explicit summation involving square roots and floor/ceiling functions.
$endgroup$
– anon
Nov 10 '11 at 3:03
add a comment |
$begingroup$
By "voxel-based sphere" I mean a sphere made up of cubes. Sorry if that is not the correct terminology. Imagine a sphere made out of legos. Except each voxel is a cube (unlike most legos). Determining the voxel distribution to make the sphere I suppose would involve calculating the x/y/z of a position on the sphere and then 'snapping' it to the nearest multiple of the voxel width/height.
Here's a calculator that can generate one:
http://neil.fraser.name/news/2006/11/17/
And here is an image of one (cross sectioned):
Given the diameter of this voxel sphere (in number of voxels, e.g. '20 voxels in diameter'), how can I calculate:
- The number of voxels in the sphere if it were hollow (kind of a 'surface area')
- The number of voxels in the sphere if it were solid (kind of a 'volume')
Is there a formula possible here? :)
geometry
$endgroup$
By "voxel-based sphere" I mean a sphere made up of cubes. Sorry if that is not the correct terminology. Imagine a sphere made out of legos. Except each voxel is a cube (unlike most legos). Determining the voxel distribution to make the sphere I suppose would involve calculating the x/y/z of a position on the sphere and then 'snapping' it to the nearest multiple of the voxel width/height.
Here's a calculator that can generate one:
http://neil.fraser.name/news/2006/11/17/
And here is an image of one (cross sectioned):
Given the diameter of this voxel sphere (in number of voxels, e.g. '20 voxels in diameter'), how can I calculate:
- The number of voxels in the sphere if it were hollow (kind of a 'surface area')
- The number of voxels in the sphere if it were solid (kind of a 'volume')
Is there a formula possible here? :)
geometry
geometry
asked Nov 10 '11 at 2:56
InfinitiesLoopInfinitiesLoop
12614
12614
1
$begingroup$
Decompose it into cross sections; each segment should allow an explicit summation involving square roots and floor/ceiling functions.
$endgroup$
– anon
Nov 10 '11 at 3:03
add a comment |
1
$begingroup$
Decompose it into cross sections; each segment should allow an explicit summation involving square roots and floor/ceiling functions.
$endgroup$
– anon
Nov 10 '11 at 3:03
1
1
$begingroup$
Decompose it into cross sections; each segment should allow an explicit summation involving square roots and floor/ceiling functions.
$endgroup$
– anon
Nov 10 '11 at 3:03
$begingroup$
Decompose it into cross sections; each segment should allow an explicit summation involving square roots and floor/ceiling functions.
$endgroup$
– anon
Nov 10 '11 at 3:03
add a comment |
1 Answer
1
active
oldest
votes
$begingroup$
That's very easy, it's a function of an XYZ loop....
You would be actually doing a marching cubes kind of logic, and an ISOsurface logic for a spherical volume.
The first result is this programming query (in metacode):
var cubecount:
ForLoop(x,y,z){
If space(x,y,z) corresponds to DistanceFunction(x,y,z) == 1;
Then cubecount +=1:
question 2 is the same using >=1
For a sphere on zero of radius 1. (distancefunction is xposvectormagnitude, same thing if the sphere is origin is 0; otherwise the sphere pos equation is for the xyz loop is:
This code makes a 3d printable off axis voxel ball if you want:
num = 45.9874;
for (x =[-num-5:num+5])
{
for (y =[-num-5:num+5])
{
for (z =[-num-5:num+5])
{
if ((x+1.24)*(x+1.24)+(y+1.66)*(y+1.66)+(z+1.88)*(z+1.88)<=num)
translate([x,y,z])
cube(1);
}
}
}
https://www.thingiverse.com/thing:3075040
$endgroup$
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
});
});
}, "mathjax-editing");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "69"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
noCode: true, onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f80726%2fcalculate-volume-and-surface-area-of-a-voxel-based-sphere%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
$begingroup$
That's very easy, it's a function of an XYZ loop....
You would be actually doing a marching cubes kind of logic, and an ISOsurface logic for a spherical volume.
The first result is this programming query (in metacode):
var cubecount:
ForLoop(x,y,z){
If space(x,y,z) corresponds to DistanceFunction(x,y,z) == 1;
Then cubecount +=1:
question 2 is the same using >=1
For a sphere on zero of radius 1. (distancefunction is xposvectormagnitude, same thing if the sphere is origin is 0; otherwise the sphere pos equation is for the xyz loop is:
This code makes a 3d printable off axis voxel ball if you want:
num = 45.9874;
for (x =[-num-5:num+5])
{
for (y =[-num-5:num+5])
{
for (z =[-num-5:num+5])
{
if ((x+1.24)*(x+1.24)+(y+1.66)*(y+1.66)+(z+1.88)*(z+1.88)<=num)
translate([x,y,z])
cube(1);
}
}
}
https://www.thingiverse.com/thing:3075040
$endgroup$
add a comment |
$begingroup$
That's very easy, it's a function of an XYZ loop....
You would be actually doing a marching cubes kind of logic, and an ISOsurface logic for a spherical volume.
The first result is this programming query (in metacode):
var cubecount:
ForLoop(x,y,z){
If space(x,y,z) corresponds to DistanceFunction(x,y,z) == 1;
Then cubecount +=1:
question 2 is the same using >=1
For a sphere on zero of radius 1. (distancefunction is xposvectormagnitude, same thing if the sphere is origin is 0; otherwise the sphere pos equation is for the xyz loop is:
This code makes a 3d printable off axis voxel ball if you want:
num = 45.9874;
for (x =[-num-5:num+5])
{
for (y =[-num-5:num+5])
{
for (z =[-num-5:num+5])
{
if ((x+1.24)*(x+1.24)+(y+1.66)*(y+1.66)+(z+1.88)*(z+1.88)<=num)
translate([x,y,z])
cube(1);
}
}
}
https://www.thingiverse.com/thing:3075040
$endgroup$
add a comment |
$begingroup$
That's very easy, it's a function of an XYZ loop....
You would be actually doing a marching cubes kind of logic, and an ISOsurface logic for a spherical volume.
The first result is this programming query (in metacode):
var cubecount:
ForLoop(x,y,z){
If space(x,y,z) corresponds to DistanceFunction(x,y,z) == 1;
Then cubecount +=1:
question 2 is the same using >=1
For a sphere on zero of radius 1. (distancefunction is xposvectormagnitude, same thing if the sphere is origin is 0; otherwise the sphere pos equation is for the xyz loop is:
This code makes a 3d printable off axis voxel ball if you want:
num = 45.9874;
for (x =[-num-5:num+5])
{
for (y =[-num-5:num+5])
{
for (z =[-num-5:num+5])
{
if ((x+1.24)*(x+1.24)+(y+1.66)*(y+1.66)+(z+1.88)*(z+1.88)<=num)
translate([x,y,z])
cube(1);
}
}
}
https://www.thingiverse.com/thing:3075040
$endgroup$
That's very easy, it's a function of an XYZ loop....
You would be actually doing a marching cubes kind of logic, and an ISOsurface logic for a spherical volume.
The first result is this programming query (in metacode):
var cubecount:
ForLoop(x,y,z){
If space(x,y,z) corresponds to DistanceFunction(x,y,z) == 1;
Then cubecount +=1:
question 2 is the same using >=1
For a sphere on zero of radius 1. (distancefunction is xposvectormagnitude, same thing if the sphere is origin is 0; otherwise the sphere pos equation is for the xyz loop is:
This code makes a 3d printable off axis voxel ball if you want:
num = 45.9874;
for (x =[-num-5:num+5])
{
for (y =[-num-5:num+5])
{
for (z =[-num-5:num+5])
{
if ((x+1.24)*(x+1.24)+(y+1.66)*(y+1.66)+(z+1.88)*(z+1.88)<=num)
translate([x,y,z])
cube(1);
}
}
}
https://www.thingiverse.com/thing:3075040
answered Oct 5 '18 at 15:40
com.prehensiblecom.prehensible
18511
18511
add a comment |
add a comment |
Thanks for contributing an answer to Mathematics Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
Use MathJax to format equations. MathJax reference.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f80726%2fcalculate-volume-and-surface-area-of-a-voxel-based-sphere%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
$begingroup$
Decompose it into cross sections; each segment should allow an explicit summation involving square roots and floor/ceiling functions.
$endgroup$
– anon
Nov 10 '11 at 3:03