Sign in to follow this  

The Problems about the Geometric Sketching in 3D

This topic is 2395 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, all:

I am involved in a project which needs a 3D sketching system,just like google's SketchUp. It is evident that a mouse position on the screen has numerous mapping points in 3D world space.

How to get the position of point in 3D when I am trying to draw the vertices in a polyline on the screen,Does anyone know the conventional approach to handle this problem?Thanks!

Share this post


Link to post
Share on other sites
Shoot a ray from the mouse position into the scene. Where-ever it collides you can place your point or select the object. Basically raycasting into your scene ;)

Here's an example of someone doing it in unity3D, this is not specific for unity but it gives you an idea of how it works. http://answers.unity3d.com/questions/16996/raycasting-as-a-selection-tool.html

Share this post


Link to post
Share on other sites
Well, you have to define the behavior. You can constrain the sketch to one of the base planes or to a screen aligned plane, arbitrary drawing plane, etc. It's really up to the designer (you) to decide. If you know what you want, we can give specific help.

Share this post


Link to post
Share on other sites
Hi,0x3a,szecs,
Thank you for your rapid replay!

so ,it seems that there should exist two planes for sketch,one for ground, and other one for screen-aligned plane which is always oriented towards the user..

after the establishment of these planes,any position on screen will be mapped into a vertex on one of the planes by the ray passing through mouse point on screen.

It is a really good suggestion, but Is this approach commonly used by softwares?

Share this post


Link to post
Share on other sites
Fact is that there is a need to reduce the infinite positions on the ray to just 1. This can be done by choosing an intersection point of the ray with a surface. In special circumstances the surface could be bend or whatever, but then the surface should be visible to the user to allow an estimation where the clicked point will be. In the general case, however, such a surface may be implicitly given, and then aligned planes are a "natural" choice.

Lets name this the [i]input plane[/i]. As szecs has already mentioned above, the placement of the input plane is mainly implementation dependent. However, there are also cases where constraints define the placement. E.g. a face constructed interactively may be required to be flat. Sketching softwares usually allow to construct faces with more than 3 corners. Hence the first 3 vertices, if being pairwise non-colinear, define a plane in which each other vertex of the face has to be placed, too. In this example the input plane is perhaps parallel to the view plane for the first three clicks, but for the 4-th and following clicks it is defined by geometry.

Of course, there is no force to always use the same set-up for the input plane in cases where the input plane is not constraint. Different tools or even selectors may be provided that implicitly or explicitly pick of the several choices. Tools itself may have their own input planes, too. E.g. a rotation tool may provide 3 input planes wherein the rotation handles (e.g. the well known colored rings) of the 3 cardinal directions lie, as well as a 4-th one parallel to the view plane e.g. a trackball may lie.

Share this post


Link to post
Share on other sites
Well, the most common thing is using a base plane (horizontal plane in 3D view), or using a user defined arbitrary drawing plane, or an auto calculated plane: the plane of triangle "under" the first click for example (see 3ds MAX "autogrid" feature). You could implement whatever the project (or the project management) needs. Just ask them what they want to be implemented. You could implement all of them and have a little drop down menu or radio button group to select the method to get the drawing plane.

To be honest, it shouldn't be hard to implement all, and experiment with them. Just write a generic ray-plane intersecting sketch function, and pass the plane as a parameter to the function.

Share this post


Link to post
Share on other sites

This topic is 2395 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this