# create a collection of vertex for a solid with a collection of Planes?

guyuming shared this question 2 years ago

I want to draw mineral crystal with Geogebra. Basically, I input a collection of Planes in 3D, and want to get the solid which is enclosed with all these Planes.

Take octahedron for example, i cannot use the octahedron command, since crystal in real world does not have the theoretical shape, it is just all eight surface keep the same angle as octahedron, but different surface can have different distance to the center point of the crystal.

A Plane is represented with equation: ax+by+cz=k. So, I define two lists for my "octahedron":

one list named "O" is for the eight "k"s of the equations, which is proportional to the distance of the plane to point (0,0,0).

the other list named "Oabc" is a matrix of the eight a,b,c coefficient, which represents intercepts on three axis.

Then, i can define a sequence of eight Planes named "OPlanes" with these two lists.

Next, i get sequence named "OPlanesIntersect", which is the collection of lines created by IntersectPath of Planes.

After that, I can get a collection of Points named "LineIntersects" by Intersect those lines in "OPlanesIntersect".

Not all these points is useful for me, only those points on at least three lines form a vertex of the solid. So, i need to get those points, the problem is how? the points in "LineIntersects" have duplicates, seems that i only need to count the frequency, and get those with frequency count more than 3.

I tried the command Frequency(LineIntersects), but it does not work, and Sort(LineIntersects) does not seem to return result as i expect.

If these cannot be done with ggb command, is it possible with javascript? or develope a new command with Java will be better for this?

1

Note: I do not know if the mathematical principles are correct. The following only refers to the question "at least 3 OPlanesInterset for one LineIntersect

----------------------------------------

"OPlanesIntersect" and "LineIntersects" have duplicates

eliminate duplicates with: Unique(<list>) and eliminate undefines with RemoveUndefined(<list>)

now you can count how many OplanesIntersect has one LineIntersects with:

l3 = Zip(Sum(Zip(If(Distance(Li, OP) ≟ 0, 1, 0), OP, OPlanesIntersect)), Li, LineIntersects)

in your sample all has 3 or 6 OPlanesIntersect.

If not, you can write

LineIntersects_3 = RemoveUndefined(Sequence(If(l3(n) ≥ 3, LineIntersects(n)), n, 1, Length(l3)))

1

Thanks for your understanding of what i was talking and for the helpful tips!

You are right in that my algorithm was incorrect. when i initially saw the resulting points, i had thought that some of them was just intersected by two line. Now i pick out manually the points, join them with segments for show the actual crystal, and i see that those useless points also formed by three lines.

What's important is i need to find out an algorithm to filter out this useless points. My idea now is: for a point A, compute a segment between A and the center (0,0,0), if this segment intersect with any Plane at a point B, and if A<>B, then A is a useless point.

Please suggest if anything wrong or other idea. And i will ask for help again if i get programming problems for this new algorithm.

1

1

1

finished version that figure out the true vertex and edges for crystal automatically: https://www.geogebra.org/cl...

I make some naming change hope the code can be more readable:

List O renamed to OAdjustable, you can adjust the numbers in the list to see how real world crystal deviate from ideal shape.

List Oabc renamed to OInheritance. This matrix define a certain type of crystal, if you input another set of equations for Planes, you can experience with another kind of crystal.

1

he intentado hacer la figura pero al no haber visto la forma esperada ni entender bien la descripción en ingles no he conseguido hacerla entera

por otra parte si tengo dos rectas que se cortan, dadas por planos r1={pi1,pi2} y r2={pi3,pi4} entonces los cuatro planos forman un sistema compatible determinado y entonces el punto de interseccion está en r1, r2 y además en r3={pi1,pi3} si los planos no son paralelos. así que si un punto está en dos de las rectas entonces está en tres y no es necesario discriminarlo

Files: foro.ggb
1

es ésta? si es así hay formas más faciles de llegar a hacerla