Hi Guys,
Need to find out the project point on mesh element.
using the below function i am getting wrong output.
mdlProject_perpendicular(&ProjectPt,NULL,NULL,MeshElmDescr,MASTERFILE,Pointtoproject,NULL,0.00);
How to get project point on mesh element ?
Unknown said:Using the below function i am getting wrong output
Please be more explicit. If you phone the doctor and say "I am ill, please give me some medicine" you are likely to receive an unhelpful reponse. If you want a diagnosis, you must tell the doctor your symptoms.
What is the 'wrong output'? What status code does the function return?
Regards, Jon Summers LA Solutions
Hi Jon,
Here is the function used for project point and debug.
mdlProject_perpendicular(&ProjectPt,NULL,NULL,gFinalDynShpElmDescr,MASTERFILE,&ElmVer[j],NULL,0.00);
mdb> ElmVer[j]
.x = 70934775.421326503
.y = 281863485.86801028
.z = 20538.92767599841
mdb> ProjectPt
.x = 8.0017527547837894e-078
.y = -5.1645010176166069e+120
.z = 2.0425610856036236e-312
int status = mdlProject_perpendicular (...);
mdb> status
Unknown said: .x = 8.0e-078 .y = -5.1e+120 .z = 2.0e-312
.x = 8.0e-078 .y = -5.1e+120 .z = 2.0e-312
Hmmm. It does seem unlikely that the projected point is several light years from the mesh 8-)
You're passing a tolerance of zero. I don't know if that might cause problems in the algorithms involved. Try passing a non-zero value, such as 1 UOR... const double Tolerance = 1.0;int status = mdlProject_perpendicular (..., Tolerance);
int status = non zero ---- error.
Generated mesh in this process.
mdlSelect_addElement(PointFilepos,MASTERFILE,&PointElm,TRUE); /// Adding the required points to selection.
mdlInput_sendSynchronizedKeyin("FACET TRIANGULATE XYPOINTS;Selview 1", 0, 0, ustnTaskId); ///// by using this keyin generating the mesh.
Unknown said:int status = non zero ---- error
And what is that status value? Sometimes the error values are helpful. There's no reason to keep it a secret, is there?
Status Value = 32768
Unknown said:Status Value = 32768
Unfortunately, that's a catch-all error code, defined in <bentley.h>...
typedef enum BentleyStatus { SUCCESS = 0, BSISUCCESS = 0, ERROR = 0x8000, BSIERROR = 0x8000, } BentleyStatus;It tells us 'something went wrong', which we already know.
Unknown said:mdlProject_perpendicular(... ,NULL, ...);
You're passing NULL for the rotation matrix. The documentation doesn't comment whether NULL is valid here. Try substituting an identity matrix...
RotMatrix rotation; mdlRMatrix_getIdentity (&rotation); ... int status = mdlProject_perpendicular(... ,&rotation, ...);
RotMatrix rotmatrix;
mdlRMatrix_getIdentity(&rotmatrix);
mdlRMatrix_fromNormalVector(&rotmatrix,&ElmVer[j]);
Status = mdlProject_perpendicular(&ProjectPt,NULL,NULL,MeshElmDescr,MASTERFILE,&ElmVer[j],&rotmatrix,0.00);
mdb> Status32768
mdb> ProjectPt.x = 2.2620409983992711e-111.y = 71045882.188718617.z = 281890399