question about get the point's normal vector

question about get the point's normal vector

2011301610406
Enthusiast Enthusiast
1,223 Views
5 Replies
Message 1 of 6

question about get the point's normal vector

2011301610406
Enthusiast
Enthusiast

微信图片_20180628153524.jpg

 

After executing this statement“const AcGeVector3d *pVectorList=mReturnData->normals();"

I find "pVectorList=NULL",

How can I get the normals of this points?

 

0 Likes
Accepted solutions (1)
1,224 Views
5 Replies
Replies (5)
Message 2 of 6

tbrammer
Advisor
Advisor

If mReturnData->normals();  returns NULL than your point cloud data doesn't contain normals.

Calculating good normals for a point cloud is a complex mathematical problem.

The fist step is to create a mesh that represents the surface of the object that your point cloud describes.

This requires to analyze which points are the direct neighbours for each point. A IAcDbPointCloudPointProcessor could help to do this efficiently.

When you have a mesh you can calculate normals for each triangle mesh and "sum them up" at each point.

I haven't worked much with point clouds yet except for this posting. So I can't help with implementation details.


Thomas Brammer ● Software Developer ● imos AGLinkedIn
If an answer solves your problem please [ACCEPT SOLUTION]. Otherwise explain why not.

0 Likes
Message 3 of 6

zrobert
Advocate
Advocate

Hi;

Arx documentation says that normals () Method "Returns a pointer to the array of point normals, or NULL if not available". So, try checking your mReturnData again.

0 Likes
Message 4 of 6

zrobert
Advocate
Advocate

Sorry, i wrote the answer at the same time as you.

Message 5 of 6

2011301610406
Enthusiast
Enthusiast

I think my point cloud data has  normal vectors because it can be successful when performing normal vector rendering on point cloud data."pCloud->setStylizayionType(AcDbPointCloudEx::KNormalRamp);"The method of using network construction is too cumbersome and slow. I still hope to obtain the normal vector of the point directly.Is there any other way to get the normal vector?

0 Likes
Message 6 of 6

tbrammer
Advisor
Advisor
Accepted solution

I think I know what the problem is. When you call

 

pCloud->getPointDataByPrecision(mReturnData, precision, pSpatialFilter, pAttributeFilter,

dataTypes, maxPointLimitation);

 

The parameter Adesk::UInt32 dataTypes must contain the flag IAcDbPointCloudDataBuffer::kNormal:

   Adesk::UInt32 dataTypes = IAcDbPointCloudDataBuffer::kNormal;

Otherwise your mReturnData won't contain normals.

 

By the way: I think it is wrong to call

    delete pPointList;

    delete pVectorList;

These array pointers are returned as const pointers. The usual ObjectARX API contract is, that returned const pointers must not be deleted. Although this is not explicitly stated in the docs.

But you should delete mReturnData and maybe also call  mReturnData->freeObject() before you delete it.

 

 


Thomas Brammer ● Software Developer ● imos AGLinkedIn
If an answer solves your problem please [ACCEPT SOLUTION]. Otherwise explain why not.

0 Likes