mercredi 10 mai 2017

How to generate random convex polyhedral with constrained edge length

I want to randomly generate a convex polyhedral, but with the following conditions:

  1. All vertices and edges lie within the cubic with corners (0.0, 0.0, 0.0) and (1.0, 1.0, 1.0).
  2. Let L be the length of a edge, it should satisfy Lmin <= L <= Lmax for every edge. (for example, 0.4 <= L <= 0.6)

I have tried the following Matlab code:

figure();
vetices = rand(50,3);
k = convhulln(vetices);
trisurf(k, vetices(:,1), vetices(:,2), vetices(:,3));

Then I get something like this: http://ift.tt/2q1FPWx

but this doesn't meet requirement 2, that some edges are to short and some edges are too long. I want to make the edge length distribution more concentrated.

Thanks for any advice or code. (code in Matlab, c++ or python is ok)




Aucun commentaire:

Enregistrer un commentaire