Have 1 Edge of A circle Polygon always point to -z?
1975 6 1- NicTanghe
- Member
- 193 posts
- Joined: 12月 2016
- Offline
- vusta
- Member
- 555 posts
- Joined: 2月 2017
- Offline
- NicTanghe
- Member
- 193 posts
- Joined: 12月 2016
- Offline
- vusta
- Member
- 555 posts
- Joined: 2月 2017
- Offline
NicTanghejust worked it out on the fly i think...so a circle is just an identical segment being incrementally rotated until it perfectly joins
How did you arrive at that formula ?
Btw thx u a hero.
back on itself so i started with 360/N...that didn't quite work out so i simply tried 180/N...that magically worked with one side constantly facing X direction, then it's a simple case of offsetting by 90...so really didn't set out with any fancy formula in mind, just do something...see something....then deal with it.
- Konstantin Magnus
- Member
- 670 posts
- Joined: 9月 2013
- Offline
You can rotate an edge to an axis with:
int pts[] = expandedgegroup(0, 'single_edge'); vector pos_0 = point(0, 'P', pts[0]); vector pos_1 = point(0, 'P', pts[1]); vector dir = normalize(pos_1 - pos_0); matrix3 rot = dihedral(dir, {1,0,0}); v@P -= avg(pos_0, pos_1); v@P *= rot;
https://procegen.konstantinmagnus.de/ [procegen.konstantinmagnus.de]
- NicTanghe
- Member
- 193 posts
- Joined: 12月 2016
- Offline
- NicTanghe
- Member
- 193 posts
- Joined: 12月 2016
- Offline
SO i tried to change the setup with adding a extra vertex to so it takes the edge that goes from the start of 1 edge to the end of another.
and adjuster the code to int pts = expandedgegroup(0, 'single_edge');
```
vector pos_0 = point(0, 'P', pts);
vector pos_1 = point(0, 'P', pts);
vector dir = normalize(pos_1 - pos_0);
matrix3 rot = dihedral(dir, {1,0,0});
v@P -= avg(pos_0, pos_1);
v@P *= rot;
```
this did not immediately work.
I will do more testing tomorrow and then be back. But i don't c why it doesn't work. I also do not exactly understand what expandededgegroup actually does.
or does it indeed just appoint the edges new numbers from 0-1 ?
Edit it seems in my example and basically when aplying a hacky way is just to resaple the edge to 1 edge.
and adjuster the code to int pts = expandedgegroup(0, 'single_edge');
```
vector pos_0 = point(0, 'P', pts);
vector pos_1 = point(0, 'P', pts);
vector dir = normalize(pos_1 - pos_0);
matrix3 rot = dihedral(dir, {1,0,0});
v@P -= avg(pos_0, pos_1);
v@P *= rot;
```
this did not immediately work.
I will do more testing tomorrow and then be back. But i don't c why it doesn't work. I also do not exactly understand what expandededgegroup actually does.
or does it indeed just appoint the edges new numbers from 0-1 ?
Edit it seems in my example and basically when aplying a hacky way is just to resaple the edge to 1 edge.
Edited by NicTanghe - 2021年3月17日 09:13:11
-
- Quick Links