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

carpet() gets cut at some viewpoints #5

Open
schneiderfelipe opened this issue Jan 7, 2021 · 3 comments
Open

carpet() gets cut at some viewpoints #5

schneiderfelipe opened this issue Jan 7, 2021 · 3 comments

Comments

@schneiderfelipe
Copy link

The following code produces the image below, which I find surprising:

using Thebes, Luxor

@draw begin
	origin()
	background("grey10")
	θ = π/4
	ϕ = π/3
	eyepoint(Point3D(250cos(θ) * sin(ϕ), 250sin(θ) * sin(ϕ), 100cos(ϕ)))
	sethue("grey90")
	carpet(300)
	axes3D()
	for i in 1:300
		sethue("lightblue")
		randpoint3D = Point3D(rand(0.0:200, 3)...)
		pin(randpoint3D,
			gfunction=(_, p2) -> circle(p2, 2, :fill)
		)
		sethue("grey30")
		pin(Point3D(randpoint3D.x, randpoint3D.y, 0),
			gfunction=(_, p2) -> circle(p2, 2, :fill)
		)
	end
end 1000 1000

surprising

By changing θ and ϕ, less or more of the xy circle gets shown. The same thing happens with @png and @svg. Am I missing something?

Versions used:

(@v1.4) pkg> status Thebes Luxor
Status `~/.julia/environments/v1.4/Project.toml`
  [ae8d54c2] Luxor v2.7.0
  [8b424ff8] Thebes v0.4.0
@cormullion
Copy link
Owner

Hi there! I think this might just be how the clipping works when there's no perspective. In your example, you're

distance(Point3D(0, 0, 0), eyepoint()) = 222.2048604328897

222 units from the origin, but the carpet has radius 150, so at the front it's very close, probably too near to you to be drawn, and so it gets clipped.

If you turn on the perspective, lines can be distorted more:

	perspective(150)

and you'll get a better idea of how close you are:

Screenshot 2021-01-08 at 10 46 28

I do struggle with this 3D stuff, I admit. While I consider Thebes.jl a bit of a toy, I occasionally find it useful for the odd logo... :)

@schneiderfelipe
Copy link
Author

Now I see. Thanks for the explanation!

While I consider Thebes.jl a bit of a toy, I occasionally find it useful for the odd logo... :)

I think Thebes.jl is awesome! I never managed to use Makie.jl to produce a scene piece by piece like it is possible with Thebes.jl (like drawing spheres, etc.). I'm interested in using Julia to produce scientific diagrams/animations, small figures for publications, etc. Thebes.jl seems perfect for that.

@cormullion
Copy link
Owner

Ha, I'm not very confident that Thebes will satisfy your needs, but I'm very happy to help you establish its limitations... :)

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