Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tried adding parents to TetrahedralLee #70

Closed
bathoorn opened this issue Jul 10, 2024 · 7 comments · Fixed by #71
Closed

Tried adding parents to TetrahedralLee #70

bathoorn opened this issue Jul 10, 2024 · 7 comments · Fixed by #71

Comments

@bathoorn
Copy link

Hi,

i made some changes to TetrahedralLee so i can add parents and it also supports setting the root of the tree in other places than faces[0]. I added it to my fork here if you want to see.

Here are some images created whith the snapshot unittests

tetra1
tetra2
tetra3
tetra4

i also tried generating svg's but that is not working flawless yet.

@bathoorn
Copy link
Author

And the code of the snapshots

export async function tetra1() {
  return renderWorld(
    geoTetrahedralLee()
      .parents([-1, 3, 1, 2])
      .rotate([115, -54.735610317245346, 90])
      .precision(0.1)
      .fitSize([width, height], { type: "Sphere" })
  );
}

export async function tetra2() {
  return renderWorld(
    geoTetrahedralLee()
      .parents([2, -1, 3, 0])
      .angle(90)
      .rotate([115, -54.735610317245346, 90])
      .precision(0.1)
      .fitSize([width, height], { type: "Sphere" })
  );
}

export async function tetra3() {
  return renderWorld(
    geoTetrahedralLee()
      .parents([3, 0, -1, 1])
      .angle(-30)
      .rotate([115, -54.735610317245346, 90])
      .precision(0.1)
      .fitSize([width, height], { type: "Sphere" })
  );
}

export async function tetra4() {
  return renderWorld(
    geoTetrahedralLee()
      .parents([1, 2, 0, -1])
      .angle(210)
      .rotate([115, -54.735610317245346, 90])
      .precision(0.1)
      .fitSize([width, height], { type: "Sphere" })
  );
}

@Fil
Copy link
Member

Fil commented Jul 10, 2024

Are you generating an isolated face? I believe you can solve this with leeRaw directly—without having to go through the polyhedral transform.

However, I do understand adding a parents method if the goal is to detach a side triangle and reattach it to another side, like so:

 ▲
△▽△    =>    △▽△▼

@bathoorn
Copy link
Author

Yes i was trying to get isolated faces so i can get them in the laser cutter easier.
For most of the other polyhedrons this worked but tetrahedralLee did not support the parents.
This indeed also allows different cofigurations which might save on wood when cutting.

I will see if i can also get this to work with leeRaw.

@bathoorn
Copy link
Author

that is a nice one recreating it with the voronoi function.

@bathoorn
Copy link
Author

works great!

I got some little artifacts in the red lines but that is something i do myself using geoInterpolate to draw all the edges of all the faces.

image

@Fil
Copy link
Member

Fil commented Jul 11, 2024

Yes, the raw projection is quite unstable at this vertex — you can use a straight line connecting the projected vertices rather than line interpolation.

@Fil Fil closed this as completed in #71 Jul 11, 2024
@Fil Fil closed this as completed in 8414fe5 Jul 11, 2024
@bathoorn
Copy link
Author

this is what i used it for :)

IMG20240630155425
IMG20240630155439

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants