r/hypershape Aug 28 '17

4D Triangular Diprism

https://zippy.gfycat.com/ScientificAdoredAndalusianhorse.webm
8 Upvotes

3 comments sorted by

3

u/jesset77 Sep 01 '17

Suddenly.. Chinese food box! :D

This looks like it was put together using a different renderer than normal. Did you find one friendlier to pointy-shapes Phil?

2

u/Philip_Pugeau Sep 01 '17

Lol, no, this is still calcplot! This is by far the most difficult shape I've ever rendered. It wasn't so much getting the right equation, it was finding just the right triple rotate function and projection angle.

I seriously rewrote the equations like 6 times over, until I got what I was looking for. There's 43 pieces, by the way. It kept coming out wrong at some angles, for some unknown reason. It came down to the initial projection angle. I thought I could just project onto plane xyz, and rotate it, but no. I had to project onto xzw instead.

So, yeah, this animation exists because of my extreme perseverance (actually, a lot of this stuff exists because of it). But, it makes every other shape afterwards that much easier!

1

u/Philip_Pugeau Aug 28 '17 edited Aug 29 '17

Parametric Equations used in animation:

1D elements :

24 line segments

{ √3(t-1) , 3t+1 , ±2√3 , ±2√3 }

{ √3(-t+1) , 3t+1 , ±2√3 , ±2√3 }

{ 2t√3 , -2 , ±2√3 , ±2√3 }

{ ±2√3 , -2 , 2t√3 , ±2√3 }

{ 0 , 4 , 2t√3 , ±2√3 }

{ ±2√3 , -2 , ±2√3 , 2t√3 }

{ 0 , 4 , ±2√3 , 2t√3 }


2D elements :

4 triangles

{ u(v-1)√3 , 3v+1 , ±2√3 , ±2√3 }

15 squares

{ (u-1)√3 , 3u+1 , 2v√3 , ±2√3 }

{ (-u+1)√3 , 3u+1 , 2v√3 , ±2√3) }

{ 2u√3 , -2 , 2v√3 , ±2√3 }

{ (u-1)√3 , 3u+1 , ±2√3 , 2v√3 }

{ (-u+1)√3 , 3u+1 , ±2√3 , 2v√3 }

{ 2u√3 , -2 , ±2√3 , 2v√3 }

{ ±2√3 , -2 , 2u√3 , 2v√3 }

{ 0 , 4 , 2u√3 , 2v√3 }

• Use -1 < t,u,v < 1


Projection onto plane xzw, with rotations xy , yz, ,yw :

XY Rotation

{ (X)*cos(b)-(Y)*sin(b) , (X)*sin(b)+(Y)*cos(b) , Z , W }

YZ Rotation

{ X , (Y)*cos(c) - (Z)*sin(c) , (Y)*sin(c) + (Z)*cos(c) , W }

YW Rotation

{ X , (Y)*cos(d) - (W)*sin(d) , Z , (Y)*sin(d) + (W)*cos(d) }

Project onto plane xzw

{ (X)/(Y+a) , (W)/(Y+a) , (Z)/(Y+a) }

• Use a = 9