Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hollow sphere has redundant nodes #191

Closed
HybridDog opened this issue Feb 12, 2020 · 2 comments
Closed

Hollow sphere has redundant nodes #191

HybridDog opened this issue Feb 12, 2020 · 2 comments

Comments

@HybridDog
Copy link
Contributor

one node reoved from hspher

To add only the necessary nodes, I think that the sphere surface needs to be sampled from all three cartesian directions.
If you use only one direction, holes appear:
sphere_from_top
This happens because the angle between the surface normal and this direction is bigger than 45° (see left of where the arrow points).

If the surface is sampled from all three directions, no holes should appear. Positions at the opposite surface sides are trivial because of the symmetry.
sphere_directions

Assume that the surface is sampled in Z direction (an orthographic projection). The height at (x,y) is then sqrt(r*r-x*x-y*y) if (x,y) is on the surface.
The (transposed) gradient is (-x/sqrt(r*r-x*x-y*y), -y/sqrt(r*r-x*x-y*y)). If both the (absolute value of the) x and y component of the gradient are less than one, holes cannot appear, so these positions need to be sampled in the Z direction.
|-x/sqrt(r*r-x*x-y*y)| <= 1, x <= sqrt(r*r-x*x-y*y), x*x <= r*r-x*x-y*y, 2*x*x <= r*r-y*y

forall x, y:
	if x*x+y*y <= r*r  -- on circle, this test is actually redundant
	and 2*x*x <= r*r-y*y and 2*y*y <= r*r-x*x then  -- small gradient
		z = round(sqrt(r*r-x*x-y*y))
		-- add nodes at (x,y,z) and (x,y,-z)
	end
end
-- do the same in X and Y directions

Why does the hollow sphere currently have more nodes than necessary?

@HybridDog
Copy link
Contributor Author

Are the redundant nodes added so that connected glass domes look more connected?

@sfan5
Copy link
Collaborator

sfan5 commented Sep 12, 2021

No idea but I'm willing to consider this a feature.

@sfan5 sfan5 closed this as completed Sep 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants