THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 11/11/2002 at 02:25, xxxxxxxx wrote:
Quote: Originally posted by Mikael Sterner on 11 November 2002
>
> * * *
>
>> Quote: Originally posted by 3D Designer on 10 November 2002
>>
>> * * *
>>
>> Hi,
>>
>> I am about to make a Tool Plugin and need the position on an edge when the mouse pointer gets over it. So when the mouse pointer is over a certain edge (position) these Coordinates should be returned. What would be the best way? Could somebody point me into the right direction?
>
> This should be done in ToolData::GetCursorInfo() then. An easy way is to use the collider library. I don't know if it's the fastest way. Either you can use GeRayCollider and look for barrycentric coordinates close to zero (this cannot detect when you're close to an edge outside the object) :
>
>
\>
\>
\> BaseObject* obj = doc->GetActiveObject();
\> > if (!obj) return FALSE;
\>
\>
\>
\>
\> AutoAlloc<GeRayCollider> rc;
\> > if (!rc) return FALSE;
\> > rc->Init(obj, TRUE);
\>
\>
\>
\>
\> Vector wtail = bd->SW(Vector(x,y,0));
\> > Vector whead = bd->SW(Vector(x,y,10000.0));
\> > Vector otail = (!obj->GetMg()) * wtail;
\> > Vector oray = (whead - wtail) ^ (!obj->GetMg());
\>
\>
\>
\>
\> rc->Intersect(otail, !oray, 10000.0);
\>
\>
\>
\>
\> GeRayColResult res;
\> > if (rc->GetNearestIntersection(&res))
\> > {
\> > // look at res.barrycoords
\> > }
\>
\>
>
> You could probably also use GeColliderEngine with a probe triangle as second collision object to overcome the outside limitiation.
>
> * * *
Hi Mikael,
thanks very much for the quick response. That looks fine. I will try that.
Best
Samir