Viewport Select Radius
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 25/07/2011 at 11:40, xxxxxxxx wrote:
Any thoughts on this?
There has to be a different way to get the points within a radius around the point at GetNearestPoint. Because the live select tool is super fast at any poly count.
Thanks,
Shawn
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 25/07/2011 at 12:04, xxxxxxxx wrote:
LOL.. okay so iterating through all the pixles within the radius is SUPER slow HAHA.. hmmm.. I'll figure this out.. ! LOL I am determined.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 26/07/2011 at 02:47, xxxxxxxx wrote:
Hi Shawn,
I've been thinking about this and I would probably try something like this (but I have no idea if it works) :
1. when you start selecting points, do GetPointS on the object to get the selected points (if any)
2. as you call GetNearestPoint, go through the returned ViewportPixel structure; for each entry in the list, add the value in ViewportPixel.i to the BaseSelect you got in step 1 by calling BaseSelect::Select(ViewportPixel.i)When you stop selecting points, if this works the BaseSelect should contain the selected points. It all falls down though if the BaseSelect returned in step 1 is NULL if there are no selected points. You would have to try it and see.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 26/07/2011 at 05:06, xxxxxxxx wrote:
Hi Steve,
That is pretty much what I do to add to the selection. The problem I am encountering is that when I do this, ViewportiPixel::i only returns the point that directly closest to the mouse, not all points within the radius. So to solve that I would iterate through all the points in the object and use BaseSelect to select any points that were a certain distance away from the point selected which works (kinda). It get very slow with objects that have many points.
Also this method is object based and selects points based on distance on the object. The live select tool selects points based on the radius of the circle guide that is drawn. You can see that the selections are based on the Screen coordinates. That is the effect I am looking for.
Some how, I need to get the location of the pixels on the screen that are within the radius and test GetNearestPoint() against those pixels.
Any thoughts on how I would iterate through the pixels within the radius of ViewportSelect::ShowHotSpot() ?
Thanks for the response Steve
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 26/07/2011 at 05:58, xxxxxxxx wrote:
Right, got you. I thought GetNearestPoint would return a list of points within the specified radius, not just one point.
There must be a way of doing it... I can't see any immediate answer, but I'll have another think.
Edit - does sculpting.cpp in the SDk example source help? It uses GetPixelInfoPoint rather than GetNearestPoint. I haven't tried to work out how it works, but it might help do what you want to do.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 26/07/2011 at 06:26, xxxxxxxx wrote:
I did look at that source a couple days ago but the only thing I could glean from it was that GetPixelInfoPoint gave me information about the point that was behind the mouse. Not the pixels within the radius. HAHA seems like this is gonna be a tough one to solve.. Must be that screen based is the way to go, because the live select tool selects points at the radius of that circle no matter how close or far away from the object the camera is, so it must be using screen coordinates to determine which points to select.
Oh how I wish GetNearestPoint returned all the points within the radius HAHA
Thanks again.
~Shawn
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 26/07/2011 at 06:30, xxxxxxxx wrote:
Unless of course the live select tool uses a raycollider but I can't see how to do that without iterating through all the points.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 26/07/2011 at 10:20, xxxxxxxx wrote:
Why not just use GetNearestPoint() and then use a Neighbor class to get neighboring points within the radius (do a distance from the hitpoint being used as the center of the radial selection?
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 26/07/2011 at 10:25, xxxxxxxx wrote:
hmmm.. you might be on to something there Robert.
How would I get Neighboring points though? Get the neighboring polys and then get the points of those polys using
void GetPointPolys(LONG pnt, LONG** dadr, LONG* dcnt)_<_h4_>_
Thanks,
Shawn
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 26/07/2011 at 10:46, xxxxxxxx wrote:
After a bit of research and search here, you might want to stay with the ViewportSelect+ViewportPixel. Michael Welter says this:
Try
ViewportPixel* GetPixelInfoPoint(LONG x, LONG y);
ViewportPixel* GetPixelInfoPolygon(LONG x, LONG y);
ViewportPixel* GetPixelInfoEdge(LONG x, LONG y);You can iterate over all pixels in the selection area and call these. Its quite fast so it shouldn't be the bottleneck, if your are worried about that.
Note that you will need to get the pixels within the radius of the hitpoint (the selection area).
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 26/07/2011 at 10:49, xxxxxxxx wrote:
Yeah I saw that, and I attempted to iterate through the pixels and it lagged pretty bad, but maybe I iterated through the pixels wrong.
If I remember correctly, I used the current mouse location, and set up a range from negative radius to positive radius in both x and y and iterated through that to check for points at those pixel locations and that was crazy slow..
Do I interpret him meaning incorrectly?
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 26/07/2011 at 10:58, xxxxxxxx wrote:
so as a code example of how I had iterated through that.. I would so something like this.
LONG xmin = mx - radius //mx is the current mouse x position. :) LONG xmax = mx + radius LONG ymin = my - radius //my is the current mouse y position. :) LONG ymax = my + radius for(int ix = xmin; ix < xmax; ix++) { for(int iy = ymin; iy < ymax; iy++) { ViewportPixel *vp = vps->GetPixelInfoPoint(ix, iy); bsPoint->Select(vp->i); } }
Is that completely wrong HAHA?
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 26/07/2011 at 11:41, xxxxxxxx wrote:
Is the radius specified in pixels or in 3D (Real) units?
I'd do it more like this (minor changes) :
LONG xmin = mx - radius; //mx is the current mouse x position. :) LONG xmax = mx + radius; LONG ymin = my - radius; //my is the current mouse y position. :) LONG ymax = my + radius; LONG iy; ViewportPixel* vp = NULL; for(LONG ix = xmin; ix < xmax; ++ix) { for(iy = ymin; iy < ymax; ++iy) { vp = vps->GetPixelInfoPoint(ix, iy); if (vp) bsPoint->Select(vp->i); } }
Of course, this doesn't do a circular radius but a rectangular area.
Dan does something like this:
` LONG x = mx, y = my; ViewportPixel *vp = vps->GetNearestPolygon(op,x,y,rad); if(vp) { Vector mpt = Vector(mx,my,0.0); Vector pxl = Vector(x,y,0.0); if(Len(pxl - mpt) < rad) { if(ctrl) bs->Deselect(vp->i); else bs->Select(vp->i); } }`
Finally, check out the sculpting.cpp example in the plugins/cinema4dsdk folder. It uses a ViewportSelect and calls GetPixelInfoPoint().
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 26/07/2011 at 11:53, xxxxxxxx wrote:
Thanks Robert, I have talked to Dan via email about this and he ran in to the same problems that I am.. He was unable to get it to perform as efficiently as the live select tool also.
However his code for getting a circular radius is a good place to start with the pixel parsing code.I will play around with parsing the pixels as see if I can optimize that enough to work.
the radius value is a Real value obtained from the AM. This is that same value that ShowHotSPot() uses to draw the radius guide circle. I will take a look again at sculpting.cpp and see if I can get more from it.
Thanks for your time.
~Shawn
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 27/07/2011 at 18:33, xxxxxxxx wrote:
Just an update! this method was the answer.. it worked very well.. the problem I was having was I was allocating the
GetPixelInfoPoint
within the loop. Thanks Robert!
~Shawn
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 27/07/2011 at 18:48, xxxxxxxx wrote:
Final Code
LONG xmin = mx - radius; //mx is the current mouse x position. :) LONG xmax = mx + radius; LONG ymin = my - radius; //my is the current mouse y position. :) LONG ymax = my + radius; LONG iy; ViewportPixel* vp = NULL; Vector origin = Vector(mx, my, 0); for(LONG ix = xmin; ix < xmax; ++ix) { for(iy = ymin; iy < ymax; ++iy) { Vector current = Vector(ix, iy, 0); Vector dist = origin - current; Real dis = Len(dist); vp = vps->GetPixelInfoPoint(ix, iy); if (dis < radius) { if (vp) bsPoint->Select(vp->i); } } }
If anyone sees any optimization possibilities I am all ears, eyes, and fingers.. HAHA..
~Shawn
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 27/07/2011 at 21:40, xxxxxxxx wrote:
LONG xmin = mx - radius; //mx is the current mouse x position. :) LONG xmax = mx + radius; LONG ymin = my - radius; //my is the current mouse y position. :) LONG ymax = my + radius; LONG iy; ViewportPixel* vp = NULL; Vector origin = Vector(mx, my, 0); Vector current; Vector dist; Real dis; for(LONG ix = xmin; ix < xmax; ++ix) { for(iy = ymin; iy < ymax; ++iy) { current = Vector(ix, iy, 0); dist = origin - current; dis = Len(dist); if (dis < radius) { vp = vps->GetPixelInfoPoint(ix, iy); if (vp) bsPoint->Select(vp->i); } } }
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 27/07/2011 at 21:44, xxxxxxxx wrote:
Thanks Robert, I should know not to declare variables inside of loops.. LOL
~Shawn
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 27/07/2011 at 21:59, xxxxxxxx wrote:
Another thing I was wondering,
Is there a way to keep the radius guide circle that is drawn with ShowHotSpot() in line with teh mouse tip? I find that if I move my mouse faster, the radius circle ends up lagging behind a bit. It's as if it can't keep up with the mouse cursor.
Have you run in to this at all?
Thanks,
Shawn