only scale the dimensions of the box without scale the box relatively to the bounding-box

All about Windows versions
Post Reply
zzwbeyond
Posts: 15
Joined: Wed Mar 16, 2016 1:16 pm

only scale the dimensions of the box without scale the box relatively to the bounding-box

Post by zzwbeyond »

Hi,

I want to add some box(cube) which can enclosure a entity(for example a car or other some things) in the cloud point, and I want to record the center, dimensions and rotation of the box. Now I have some questions.

1. As the dimension of the box is scaled relatively to the bounding-box, So after I rotate the box, the shape of the box will change when I scale the box. Is there a way to change the dimension of the box without changing the shape?



2. After I scale the box, the dimension of the box is also same as before(I use the box function "getDimensions()" ). So How can I get the real dimension of the box after scaling?

I don't know if you understand me while my English is not very good. I will try my best to express, you can ask me if you have any questions.
Attachments
无标题.jpg
无标题.jpg (78.49 KiB) Viewed 7893 times
daniel
Site Admin
Posts: 7711
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: only scale the dimensions of the box without scale the box relatively to the bounding-box

Post by daniel »

When you are speaking of 'box', are you speaking about the bounding box of the entity, or about the box primitive (ccBox)?

Sorry I don't fully understand your questions.
Daniel, CloudCompare admin
zzwbeyond
Posts: 15
Joined: Wed Mar 16, 2016 1:16 pm

Re: only scale the dimensions of the box without scale the box relatively to the bounding-box

Post by zzwbeyond »

Yes, the 'box' I mentioned before is the box primitive(ccBox).

Now my question is:

1. After I rotate the box primitive, the shape of the box primitive will change(as show in the attachments) when I scale the box primitive. So is there a way to only scale the dimension of the box primitive without changing the shape after rotate it?

2. When I want to get the length, width and height of the box primitive, I just get the box primitive bounding box using the entity function 'getDimensions()'. How to get the length, width and height of the box primitive rather than primitive bounding box?
daniel
Site Admin
Posts: 7711
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: only scale the dimensions of the box without scale the box relatively to the bounding-box

Post by daniel »

1. How do you 'scale' the box primitive?

Anyway we could add the possibility to edit the box dimensions in the properties tab (just as the sphere radius, etc.). But programmatically we would do this with 'setDimensions'.

2. The 'getDimensions' method actually returns the real box dimensions. The bounding-box dimensions are returned by the 'getOwnBB' method.
Daniel, CloudCompare admin
zzwbeyond
Posts: 15
Joined: Wed Mar 16, 2016 1:16 pm

Re: only scale the dimensions of the box without scale the box relatively to the bounding-box

Post by zzwbeyond »

Thanks, daniel

1. I use the Multiply/Scale tool to scale the box primitive.

2. After I scale the box primitive, the dimensions of the box (use function 'getDimensions()' ) is not change. It's too weird..
daniel
Site Admin
Posts: 7711
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: only scale the dimensions of the box without scale the box relatively to the bounding-box

Post by daniel »

Indeed the 'Multiply/Scale' method doesn't change the box dimensions as it considers the primitive as a simple triangular mesh. Therefore it only changes its vertices coordinates.

You have to call 'setDimensions' on the box (you could add a small interface in your plugin to do this, or we could add this option to the properties tab).
Daniel, CloudCompare admin
Post Reply