Hi Andrew,

First, when using WorldToView note that you will be getting back depth 
information in the Z coordinate. (which is useful to reject points that are 
behind the camera)

Therefore, if you just want the points in screen-space you need to zero out the 
Z component for the returned points as shown in the tool SDK examples:

                CVector3 l_snapPos;
                if ( in_ctxt.WorldToView( m_worldPos, l_snapPos ) == 
CStatus::OK ) {
                                l_snapPos.PutZ( 0.0 ); // Remove depth info


Second, I would ditch the stuff that uses the view size and the closest_param.

I assume you want to be able to easily select both edges and verts regardless 
of camera zoom.

In that case why not simply have two tests that must both be satisfied to 
select a vertex:

1) you must be closer than X pixels to the vertex. (to avoid selecting verts 
far away when zoomed in)

2) you must be within Y pixels  to the vertex where Y is calculated as a 
percentage of the length of the edge in pixels. (to allow edges to be selected 
when zoomed out)
--
Brent

From: softimage-boun...@listproc.autodesk.com 
[mailto:softimage-boun...@listproc.autodesk.com] On Behalf Of Andrew Prostrelov
Sent: 17 October 2017 08:20
To: Official Softimage Users Mailing List. 
https://urldefense.proofpoint.com/v2/url?u=https-3A__groups.google.com_forum_-23-21forum_xsi-5Flist&d=DwIGaQ&c=76Q6Tcqc-t2x0ciWn7KFdCiqt6IQ7a_IF9uzNzd_2pA&r=GmX_32eCLYPFLJ529RohsPjjNVwo9P0jVMsrMw7PFsA&m=sVoW9tN-HMNTbKwj0HFWVtDFPQlsYhd_YLDdUqpgqgY&s=3UkTv5jOFtivia8ZS2pTnQIMyn0VbCUfOnR6Nf9lN8A&e=
 <softimage@listproc.autodesk.com>
Subject: Re: XSI Size difference issues. Pointlocators etc.

Ok. So i guess i should rephrase my previous message. I read it twice and it a 
bit clumsy and hard to understand what exactly do i want to ask about.
First of all when we deal with tools interaction it's better to see it in 
action, so here is the video: 
https://urldefense.proofpoint.com/v2/url?u=https-3A__youtu.be_Bu-5F959RYcqY&d=DwIGaQ&c=76Q6Tcqc-t2x0ciWn7KFdCiqt6IQ7a_IF9uzNzd_2pA&r=GmX_32eCLYPFLJ529RohsPjjNVwo9P0jVMsrMw7PFsA&m=sVoW9tN-HMNTbKwj0HFWVtDFPQlsYhd_YLDdUqpgqgY&s=4ioIKaCFFf4sfxlxVxnttaMVwudKe2-hnwcMtMKDgHo&e=<https://urldefense.proofpoint.com/v2/url?u=https-3A__youtu.be_Bu-5F959RYcqY&d=DwMFaQ&c=76Q6Tcqc-t2x0ciWn7KFdCiqt6IQ7a_IF9uzNzd_2pA&r=GmX_32eCLYPFLJ529RohsPjjNVwo9P0jVMsrMw7PFsA&m=iXGx3tgRku9XxL6QKca4bKDqNkNQyUmEWpbUS2r1qW0&s=Gc__V9v7859AWdArOe2x3B36Tj2wjaTYxEBOlad2S1U&e=>

Here is a simple test plugin:   
https://urldefense.proofpoint.com/v2/url?u=https-3A__www.dropbox.com_s_7pjcr1coycsnesr_PickTestTool.xsiaddon-3Fdl-3D0&d=DwIGaQ&c=76Q6Tcqc-t2x0ciWn7KFdCiqt6IQ7a_IF9uzNzd_2pA&r=GmX_32eCLYPFLJ529RohsPjjNVwo9P0jVMsrMw7PFsA&m=sVoW9tN-HMNTbKwj0HFWVtDFPQlsYhd_YLDdUqpgqgY&s=rxASYNbzV49mw5DCowxtCVeASXc52gxoR4yKXtY222s&e=<https://urldefense.proofpoint.com/v2/url?u=https-3A__www.dropbox.com_s_7pjcr1coycsnesr_PickTestTool.xsiaddon-3Fdl-3D0&d=DwMFaQ&c=76Q6Tcqc-t2x0ciWn7KFdCiqt6IQ7a_IF9uzNzd_2pA&r=GmX_32eCLYPFLJ529RohsPjjNVwo9P0jVMsrMw7PFsA&m=iXGx3tgRku9XxL6QKca4bKDqNkNQyUmEWpbUS2r1qW0&s=hmR-RVI2XfuMITwHu-GMRMCKYTvCdYvt7PnnTln009A&e=>
Just run PickTestToolStart command and hover mouse over geo.

And here is a new PickVertex() functione code: 
https://urldefense.proofpoint.com/v2/url?u=https-3A__www.dropbox.com_s_wzypuavvifsygqr_PickVertex.cpp-3Fdl-3D0&d=DwIGaQ&c=76Q6Tcqc-t2x0ciWn7KFdCiqt6IQ7a_IF9uzNzd_2pA&r=GmX_32eCLYPFLJ529RohsPjjNVwo9P0jVMsrMw7PFsA&m=sVoW9tN-HMNTbKwj0HFWVtDFPQlsYhd_YLDdUqpgqgY&s=USytyicdIY1g1vn0VgLcu9NaBl_r92VN7xuWDGgqDuQ&e=<https://urldefense.proofpoint.com/v2/url?u=https-3A__www.dropbox.com_s_wzypuavvifsygqr_PickVertex.cpp-3Fdl-3D0&d=DwMFaQ&c=76Q6Tcqc-t2x0ciWn7KFdCiqt6IQ7a_IF9uzNzd_2pA&r=GmX_32eCLYPFLJ529RohsPjjNVwo9P0jVMsrMw7PFsA&m=iXGx3tgRku9XxL6QKca4bKDqNkNQyUmEWpbUS2r1qW0&s=9NGLXNf2hRCdZbAvwVk6mES0rqOb0mP9HwMcgJxl-lI&e=>
I made it more readable, remove some stuff and add new filtering formula that 
brings result close to what we want but i am not sure about this formula.

Here is the formula:
if (        closest_param <    ( (vx + vy) / edge_vect.GetLength() )*0.01       
 )

If parameter value of current cursor projected to the closest edge is smaller 
than 0.01 part of current relative(or SCREEN size) edge size than we highilte 
this vert.
Any help is greatly appreciated.
------
Softimage Mailing List.
To unsubscribe, send a mail to softimage-requ...@listproc.autodesk.com with 
"unsubscribe" in the subject, and reply to confirm.

Reply via email to