chr1shr / voro

Voro++: a three-dimensional Voronoi cell library in C++
Other
154 stars 44 forks source link

about command-line utility #29

Closed zoro-1215 closed 1 year ago

zoro-1215 commented 1 year ago

when i use option "-wp " for plane wall, the result show that the normal vector (-1, 0, -1) is right but the displacement x4 (the distance from the point of origin to plane here i used) is wrong. i want to know how to compute the displacement x4?

chr1shr commented 1 year ago

Suppose you specify -wp <x> <y> <z> <d>. You can define a vector n=(x,y,z). This will restrict the Voronoi computation to domain of vectors r where r.n < d, where the dot is the scalar product.

The key point is that the length of n matters. The equation above does not assume that the length of n is 1, and the plane position will vary with the length.

If you definitely want the plane to be displaced by x4, then you should normalize the vector beforehand, e.g. by using -wp -0.707106781186548 0 -0.707106781186548 x4.

zoro-1215 commented 1 year ago

Suppose you specify -wp <x> <y> <z> <d>. You can define a vector n=(x,y,z). This will restrict the Voronoi computation to domain of vectors r where r.n < d, where the dot is the scalar product.

The key point is that the length of n matters. The equation above does not assume that the length of n is 1, and the plane position will vary with the length.

If you definitely want the plane to be displaced by x4, then you should normalize the vector beforehand, e.g. by using -wp -0.707106781186548 0 -0.707106781186548 x4.

it works, thank you very much!

another question: there is a insert box in our hopper(see below figure),

2023-03-27 11-23-07 的屏幕截图

is there a solution to add insert box wall using command-line utility?

chr1shr commented 1 year ago

Unfortunately, the case that you describe is more complicated, because it means that your domain is non-convex. There is no standard option to handle this.

Usually Voronoi cells are convex, and the code takes advantage of this for computational efficiency. If you work in a convex domain, then the Voronoi cells will all be convex, but if you have a non-convex domain it is possible for the Voronoi cells to be non-convex also, which the code does not handle. This could happen at the corners of the interior box.

One solution could be to break up your domain into several convex parts and analyze each separately.