public static Cylindrical Lerp(Cylindrical cyl1, Cylindrical cyl2, float k) { return(new Cylindrical( Mathf.Lerp(cyl1.rho, cyl2.rho, k), Mathf.Lerp(cyl1.theta, cyl2.theta, k), Mathf.Lerp(cyl1.z, cyl2.z, k))); }
private void FixedUpdate() { standing = Physics2D.OverlapCircle( Cylindrical.ToCartesian( new Vector2(cyln.theta, cyln.radius + bottomOffset) ), bottomRadius, collisionLayer ); }
public void Rotate(double angle) { for (int indx = 0; indx < this.Count; indx++) { this[indx] = (PathFragment)this[indx].Select(p => { Cylindrical c = p.toCylindrical; return(new Cylindrical(c.Radius, c.Angle + angle, c.Depth).toCartesian3); }); } }
public void Draw() { if (chedo == 1) // hinh tru { Cylindrical c = new Cylindrical(Height1 * 5, Length * 5, X * 5, Y * 5, Z * 5); c.Draw(g); this.form1.AX1.Text = "( " + x + " , " + y + " , " + z + " )"; this.form1.BX1.Text = "( " + x + " , " + y + " , " + (z + Height1) + " )"; this.form1.CX1.Text = "-"; this.form1.DX1.Text = "-"; this.form1.EX1.Text = "-"; this.form1.FX1.Text = "-"; this.form1.HX1.Text = "-"; this.form1.JX1.Text = "-"; } else if (chedo == 2)//hinh non { Conical c = new Conical(Length * 5, Height1 * 5, x * 5, y * 5, z * 5, Color.Black); c.Draw(g); this.form1.AX1.Text = "( " + x + " , " + y + " , " + (z + Height1) + " )"; this.form1.BX1.Text = "-"; this.form1.CX1.Text = "-"; this.form1.DX1.Text = "-"; this.form1.EX1.Text = "-"; this.form1.FX1.Text = "-"; this.form1.HX1.Text = "-"; this.form1.JX1.Text = "-"; } else if (chedo == 3)//box { Box b = new Box(Length * 5, X * 5, Y * 5, Z * 5, Color.Black); b.Draw(g); this.form1.AX1.Text = "( " + x + " , " + y + " , " + z + " )"; this.form1.BX1.Text = "( " + x + " , " + y + " , " + (z + Length) + " )"; this.form1.CX1.Text = "( " + x + " , " + (y + Length) + " , " + z + " )"; this.form1.DX1.Text = "( " + x + " , " + (y + Length) + " , " + (z + Length) + " )"; this.form1.EX1.Text = "( " + (x + Length) + " , " + y + " , " + z + " )"; this.form1.FX1.Text = "( " + (x + Length) + " , " + (y + Length) + " , " + z + " )"; this.form1.HX1.Text = "( " + (x + Length) + " , " + y + " , " + (z + Length) + " )"; this.form1.JX1.Text = "( " + (x + Length) + " , " + (y + Length) + " , " + (z + Length) + " )"; } else if (chedo == 4) { Pyramid p = new Pyramid(Height1 * 5, Length * 5, x * 5, y * 5, z * 5); p.Draw(g); this.form1.AX1.Text = "( " + x + " , " + y + " , " + (z + Length) + " )"; this.form1.BX1.Text = "( " + (x + Length) + " , " + (y - Length) + " , " + (z) + " )"; this.form1.CX1.Text = "( " + (x - Length) + " , " + (y - Length) + " , " + (z) + " )"; this.form1.DX1.Text = "( " + (x - Length) + " , " + (y + Length) + " , " + (z) + " )"; this.form1.EX1.Text = "( " + (x + Length) + " , " + (y + Length) + " , " + (z) + " )"; this.form1.FX1.Text = "-"; this.form1.HX1.Text = "-"; this.form1.JX1.Text = "-"; } else if (chedo == 5) { Globe p = new Globe(Length * 5, x * 5, y * 5, z * 5); p.Draw(g); this.form1.AX1.Text = "( " + x + " , " + y + " , " + z + " )"; this.form1.BX1.Text = "-"; this.form1.CX1.Text = "-"; this.form1.DX1.Text = "-"; this.form1.EX1.Text = "-"; this.form1.FX1.Text = "-"; this.form1.HX1.Text = "-"; this.form1.JX1.Text = "-"; } }
public Cylindrical(Cylindrical cyl) { this.rho = cyl.rho; this.theta = cyl.theta; this.z = cyl.z; }
//Tools public static Vector3 CylindricToCartesian(Cylindrical cylCoordinates) { return(new Vector3(cylCoordinates.rho * Mathf.Cos(cylCoordinates.theta), cylCoordinates.z, cylCoordinates.rho * Mathf.Sin(cylCoordinates.theta))); }
// private GameObject A; // private GameObject B; public void Awake() { cyln = GameObject.Find("Player").GetComponent <Cylindrical>(); Restart(); }
private void Awake() { cyln = GetComponent <Cylindrical>(); }
protected virtual void Awake() { inputState = GetComponent <InputState>(); cyln = GetComponent <Cylindrical>(); }