6using System.Collections;
7using System.Collections.Generic;
22 private float lastXLim;
23 private float lastYLim;
24 private float lastSuper;
35 private List<Vector2> pointList =
new List<Vector2>();
39 RecalculateSuperellipse();
41 GetComponent<MeshRenderer>().material =
material;
54 RecalculateSuperellipse();
64 void RecalculateSuperellipse()
70 for (
float i = 0; i <
xLimits; i += 1 / realLoD)
73 Vector2 tempVecTwo =
new Vector2(i, y);
74 pointList.Add(tempVecTwo);
76 pointList.Add(
new Vector2(
xLimits, 0));
77 pointList.Add(Vector2.zero);
79 GetComponent<MeshCreator>().CreateMesh(pointList);
82 float Superellipse(
float a,
float b,
float x,
float n)
84 float alpha = Mathf.Pow((x / a), n);
85 float beta = 1 - alpha;
86 float y = Mathf.Pow(beta, 1 / n) * b;
Credit Erdener Gonenc - @PixelEnvision.