Gigoga Sat, 02/19/2011 - 14:03 Forums: Other usage issuesI need to compute distance between cylinder and a point,how can i do this? Sharjith Naramp... Sun, 02/20/2011 - 05:18 Check out GeomAPI_ProjectPointOnSurf::NearestPoint(). It should be helpful not only in your case for cylinder but any surface. Log in to post comments m-sazonov (not verified) Mon, 02/21/2011 - 09:43 double CylDist(const gp_Cylinder& cyl, const gp_Pnt& pnt) { double u, v; ElSLib::Parameters(cyl, pnt, u, v); return pnt.Distance(ElSLib::Value(u, v, cyl)); } Log in to post comments Gigoga Wed, 02/23/2011 - 12:06 Thank you!it is working!=) Log in to post comments Sharjith Naramp... Mon, 02/21/2011 - 22:51 This works equally well and is more generic: double CylDist(const Handle(Geom_Surface)& cyl, const gp_Pnt& pnt) { GeomAPI_ProjectPointOnSurf PPS(pnt, cyl); return PPS.LowerDistance(); } Only issue that needs to be looked at is performance.. don't know the effect on performance. Log in to post comments Gigoga Wed, 02/23/2011 - 12:09 Sorry,but it does not link.. error LNK2028: ññûëêà íà íåðàçðåøåííóþ ëåêñåìó (0A00067F) "public: double __thiscall GeomAPI_ProjectPointOnSurf::LowerDistance(void)const " (?LowerDistance@GeomAPI_ProjectPointOnSurf@@$$FQBENXZ) â ôóíêöèè "double __cdecl CylDist2(class Handle_Geom_Surface const &,class gp_Pnt const &)" (?CylDist2@@$$FYANABVHandle_Geom_Surface@@ABVgp_Pnt@@@Z) 1>: error LNK2028: ññûëêà íà íåðàçðåøåííóþ ëåêñåìó (0A000680) "public: __thiscall GeomAPI_ProjectPointOnSurf::GeomAPI_ProjectPointOnSurf(class gp_Pnt const &,class Handle_Geom_Surface const &)" (??0GeomAPI_ProjectPointOnSurf@@$$FQAE@ABVgp_Pnt@@ABVHandle_Geom_Surface@@@Z) â ôóíêöèè "double __cdecl CylDist2(class Handle_Geom_Surface const &,class gp_Pnt const &)" (?CylDist2@@$$FYANABVHandle_Geom_Surface@@ABVgp_Pnt@@@Z) 1> error LNK2019: ññûëêà íà íåðàçðåøåííûé âíåøíèé ñèìâîë "public: double __thiscall GeomAPI_ProjectPointOnSurf::LowerDistance(void)const " (?LowerDistance@GeomAPI_ProjectPointOnSurf@@$$FQBENXZ) â ôóíêöèè "double __cdecl CylDist2(class Handle_Geom_Surface const &,class gp_Pnt const &)" (?CylDist2@@$$FYANABVHandle_Geom_Surface@@ABVgp_Pnt@@@Z) 1 error LNK2019: ññûëêà íà íåðàçðåøåííûé âíåøíèé ñèìâîë "public: __thiscall GeomAPI_ProjectPointOnSurf::GeomAPI_ProjectPointOnSurf(class gp_Pnt const &,class Handle_Geom_Surface const &)" (??0GeomAPI_ProjectPointOnSurf@@$$FQAE@ABVgp_Pnt@@ABVHandle_Geom_Surface@@@Z) â ôóíêöèè "double __cdecl CylDist2(class Handle_Geom_Surface const &,class gp_Pnt const &)" (?CylDist2@@$$FYANABVHandle_Geom_Surface@@ABVgp_Pnt@@@Z) Log in to post comments Fabian Hachenberg Wed, 02/23/2011 - 12:16 have you passed libTKGeomAlgo.so to your linker? Log in to post comments Sharjith Naramp... Wed, 02/23/2011 - 21:28 use these libraries: TKernel.lib TKMath.lib TKG3d.lib TKGeomAlgo.lib TKGeomBase.lib I have attached a simple VS2010 Express solution that I made for testing both the methods discussed above, hopefully you should find it helpful. Attachments: CylinderPointDist.zip Log in to post comments
Sun, 02/20/2011 - 05:18
Check out GeomAPI_ProjectPointOnSurf::NearestPoint(). It should be helpful not only in your case for cylinder but any surface.
Mon, 02/21/2011 - 09:43
double CylDist(const gp_Cylinder& cyl, const gp_Pnt& pnt)
{
double u, v;
ElSLib::Parameters(cyl, pnt, u, v);
return pnt.Distance(ElSLib::Value(u, v, cyl));
}
Wed, 02/23/2011 - 12:06
Thank you!it is working!=)
Mon, 02/21/2011 - 22:51
This works equally well and is more generic:
double CylDist(const Handle(Geom_Surface)& cyl, const gp_Pnt& pnt)
{
GeomAPI_ProjectPointOnSurf PPS(pnt, cyl);
return PPS.LowerDistance();
}
Only issue that needs to be looked at is performance.. don't know the effect on performance.
Wed, 02/23/2011 - 12:09
Sorry,but it does not link..
error LNK2028: ññûëêà íà íåðàçðåøåííóþ ëåêñåìó (0A00067F) "public: double __thiscall GeomAPI_ProjectPointOnSurf::LowerDistance(void)const " (?LowerDistance@GeomAPI_ProjectPointOnSurf@@$$FQBENXZ) â ôóíêöèè "double __cdecl CylDist2(class Handle_Geom_Surface const &,class gp_Pnt const &)" (?CylDist2@@$$FYANABVHandle_Geom_Surface@@ABVgp_Pnt@@@Z)
1>: error LNK2028: ññûëêà íà íåðàçðåøåííóþ ëåêñåìó (0A000680) "public: __thiscall GeomAPI_ProjectPointOnSurf::GeomAPI_ProjectPointOnSurf(class gp_Pnt const &,class Handle_Geom_Surface const &)" (??0GeomAPI_ProjectPointOnSurf@@$$FQAE@ABVgp_Pnt@@ABVHandle_Geom_Surface@@@Z) â ôóíêöèè "double __cdecl CylDist2(class Handle_Geom_Surface const &,class gp_Pnt const &)" (?CylDist2@@$$FYANABVHandle_Geom_Surface@@ABVgp_Pnt@@@Z)
1> error LNK2019: ññûëêà íà íåðàçðåøåííûé âíåøíèé ñèìâîë "public: double __thiscall GeomAPI_ProjectPointOnSurf::LowerDistance(void)const " (?LowerDistance@GeomAPI_ProjectPointOnSurf@@$$FQBENXZ) â ôóíêöèè "double __cdecl CylDist2(class Handle_Geom_Surface const &,class gp_Pnt const &)" (?CylDist2@@$$FYANABVHandle_Geom_Surface@@ABVgp_Pnt@@@Z)
1 error LNK2019: ññûëêà íà íåðàçðåøåííûé âíåøíèé ñèìâîë "public: __thiscall GeomAPI_ProjectPointOnSurf::GeomAPI_ProjectPointOnSurf(class gp_Pnt const &,class Handle_Geom_Surface const &)" (??0GeomAPI_ProjectPointOnSurf@@$$FQAE@ABVgp_Pnt@@ABVHandle_Geom_Surface@@@Z) â ôóíêöèè "double __cdecl CylDist2(class Handle_Geom_Surface const &,class gp_Pnt const &)" (?CylDist2@@$$FYANABVHandle_Geom_Surface@@ABVgp_Pnt@@@Z)
Wed, 02/23/2011 - 12:16
have you passed libTKGeomAlgo.so to your linker?
Wed, 02/23/2011 - 21:28
use these libraries:
TKernel.lib TKMath.lib TKG3d.lib TKGeomAlgo.lib TKGeomBase.lib
I have attached a simple VS2010 Express solution that I made for testing both the methods discussed above, hopefully you should find it helpful.