public void ReadEquation(string eqn, string type) { if (type == "linear") { function = FunctionOption.Linear; } if (type == "parabolic") { function = FunctionOption.Parabola; } if (type == "sine") { function = FunctionOption.Sine; } else { //Do nothing } functionReader.EqnReader(eqn, type); verticalStretch_a = functionReader.a; horizontalStretch_b = functionReader.b; verticalShift_c = functionReader.c; ; horizontalShift_d = functionReader.d; Debug.Log("a: " + verticalStretch_a + "b: " + horizontalStretch_b + "c: " + verticalShift_c + "d: " + horizontalShift_d); }
//find way to get bottom half too //ellipsoid 3d surface, variable dimensions// r = radius, xr = x rad stretch, zr = z rad stretch, yr = y rad stretch private float Ellipsoid(Vector3 p, float t, float r, float xr, float zr, float yr, float c) { function = FunctionOption.Ellipsoid; p.x = 2f * p.x - 1f; p.z = 2f * p.z - 1f; return(Mathf.Sqrt(r * r - ((p.x * p.x) / (xr * xr)) - ((p.z * p.z) / (zr * zr))) * yr + c); }
//find way to get bottom half //cone, variable dimensions// xr = x rad stretch, zr = z rad stretch, yr = y rad stretch private float Cone(Vector3 p, float t, float yr, float xr, float zr , float c) { function = FunctionOption.Cone; p.x = 2f * p.x - 1f; p.z = 2f * p.z - 1f; return Mathf.Sqrt(((p.x * p.x) / (xr * xr)) + ((p.z * p.z) / (zr * zr))) * yr + c; }
private void FunctionDial() { switch (funcOption) {//현재 상태에서 버튼 입력시 다음단계로 전환 case FunctionOption.Normal: DialParent.transform.rotation = Quaternion.Euler(0, 0, 60); funcOption++; OfficerSpeak.text = ("중대장 : \n방식은 도약!"); break; case FunctionOption.Signal: DialParent.transform.rotation = Quaternion.Euler(0, 0, 30); funcOption++; OfficerSpeak.text = ("중대장 : \n정상으로 맞추라고 정상!"); break; case FunctionOption.Input: DialParent.transform.rotation = Quaternion.Euler(0, 0, 0); funcOption = FunctionOption.Normal; OfficerSpeak.text = ("중대장 : \n정상으로 맞추라고 정상!"); break; default: break; } }
//complicated multi sine plane, anim private float CSine(Vector3 p, float t, float c) { function = FunctionOption.CSine; return(0.50f + 0.25f * Mathf.Sin(4 * Mathf.PI * p.x + 4 * t) * Mathf.Sin(2 * Mathf.PI * p.z + t) + 0.10f * Mathf.Cos(3 * Mathf.PI * p.x + 5 * t) * Mathf.Cos(5 * Mathf.PI * p.z + 3 * t) + 0.15f * Mathf.Sin(Mathf.PI * p.x + 0.6f * t) + c); }
//paraboloid, variable dim, xr is x radius modifyer, zr is z radius modifier, c is vertical shift,yr is vertical stretch private float Parabola(Vector3 p, float t, float xr, float zr, float yr, float c) { function = FunctionOption.Parabola; p.x = 2f * p.x - 1f; p.z = 2f * p.z - 1f; return(c + ((p.x * p.x) / (xr * xr)) + ((p.z * p.z) / (zr * zr))); }
public GetEntityFunc(FunctionOption option) : base(string.Format("Get{0}", option.EntityClass), option.ReturnType, null) { _option = option; Parameters = new List <FunctionParameter>(); Parameters.Add(new FunctionParameter(_option.IdColumn.Name.ToFirstLower(), string.Format("{0}", _option.IdColumn.CSTypeName))); Parameters.Add(new FunctionParameter("cacheable", "bool")); }
//complicated multi sine plane, anim private float CSine(Vector3 p, float t, float c) { function = FunctionOption.CSine; return 0.50f + 0.25f * Mathf.Sin(4 * Mathf.PI * p.x + 4 * t) * Mathf.Sin(2 * Mathf.PI * p.z + t) + 0.10f * Mathf.Cos(3 * Mathf.PI * p.x + 5 * t) * Mathf.Cos(5 * Mathf.PI * p.z + 3 * t) + 0.15f * Mathf.Sin(Mathf.PI * p.x + 0.6f * t) + c; }
public GetEntitiesFunc(FunctionOption option, string FunName) : base(string.Format("Get{0}", FunName.ToPlural()), option.ReturnType, null) { _option = option; Parameters = new List <FunctionParameter>(); Parameters.Add(new FunctionParameter(_option.IdColumn.Name.ToFirstLower().ToPlural(), string.Format("{0}[]", _option.IdColumn.CSTypeName))); Parameters.Add(new FunctionParameter(string.Format("{0}Cacheable", _option.EntityClass.ToFirstLower().ToPlural()), "bool")); }
//cool ripple plane, anim private float Ripple(Vector3 p, float t, float c) { function = FunctionOption.Ripple; p.x -= 0.5f; p.z -= 0.5f; float squareRadius = p.x * p.x + p.z * p.z; return(0.5f + Mathf.Sin(15f * Mathf.PI * squareRadius - 2f * t) / (2f + 100f * squareRadius) + c); }
public GetEntitySetFunc(FunctionOption option) : base(string.Format("Get{0}Set", option.EntityClass), option.ReturnType, null) { _option = option; Parameters = new List <FunctionParameter>(); Parameters.Add(new FunctionParameter("pageIndex", "int")); Parameters.Add(new FunctionParameter("pageSize", "int")); Parameters.Add(new FunctionParameter("idsCacheable", "bool")); Parameters.Add(new FunctionParameter("entitiesCacheable", "bool")); }
//complicated multi sine plane, anim private float CSine(Vector3 p, float t, float c) { function = FunctionOption.CSine; //return (0.50f + // 10*( 0.25f * Mathf.Sin(8 * 5 * Mathf.PI * p.x + 4 * t) * Mathf.Sin(4 * 5 * Mathf.PI * p.z + t) + // 0.10f * Mathf.Cos(6 * 5 * Mathf.PI * p.x + 5 * t) * Mathf.Cos(10 * 5 * Mathf.PI * p.z + 3 * t) + // 0.15f * Mathf.Sin(10 * Mathf.PI * p.x + 0.6f * t) + c) ); return(0.50f + (0.25f * Mathf.Sin(4 * Mathf.PI * p.x + 4 * t) * Mathf.Sin(2 * Mathf.PI * p.z + t) + 0.10f * Mathf.Cos(4 * Mathf.PI * p.x + 5 * t) * Mathf.Cos(5 * Mathf.PI * p.z + 3 * t) + 0.15f * Mathf.Sin(Mathf.PI * p.x + 0.6f * t) + c)); }
public DeleteEntityFunc(FunctionOption option) : base( string.Format("Delete{0}", option.EntityClass) , option.ReturnType , null) { this.Option = option; Parameters = new List <FunctionParameter>(); Parameters.Add(new FunctionParameter(option.IdColumn.Name.ToFirstLower(), option.IdColumn.CSTypeName)); if (option.WithTran) { Parameters.Add(new FunctionParameter("tran", "TransactionManager")); } }
public UpdateEntityFunc(FunctionOption option) : base(string.Format("Update{0}", option.EntityClass), option.ReturnType, null) { _option = option; Parameters = new List <FunctionParameter>(); if (_option.IsBat) { Parameters.Add(new FunctionParameter(_option.EntityClass.ToFirstLower() + "s", string.Format("List<{0}>", _option.EntityClass))); } else { Parameters.Add(new FunctionParameter(_option.EntityClass.ToFirstLower(), _option.EntityClass)); } if (_option.WithTran) { Parameters.Add(new FunctionParameter("tran", "TransactionManager")); } }
public override void ExplicitVisit(FunctionOption fragment) { _fragments.Add(fragment); }
public static string ToDescriptionString(this FunctionOption options) { DescriptionAttribute[] attributes = (DescriptionAttribute[])options.GetType().GetField(options.ToString()).GetCustomAttributes(typeof(DescriptionAttribute), false); return(attributes.Length > 0 ? attributes[0].Description : string.Empty); }
//find way to get bottom half too //ellipsoid 3d surface, variable dimensions// r = radius, xr = x rad stretch, zr = z rad stretch, yr = y rad stretch private float Ellipsoid(Vector3 p, float t, float r, float xr, float zr, float yr, float c) { function = FunctionOption.Ellipsoid; p.x = 2f * p.x - 1f; p.z = 2f * p.z - 1f; return Mathf.Sqrt(r * r - ((p.x * p.x) / (xr * xr)) - ((p.z * p.z) / (zr * zr))) * yr + c; }
/////////animated graphs are below: //1 variable sine plane, anim private float Sine(Vector3 p, float t , float c) { function = FunctionOption.Sine; return 0.5f + 0.5f * Mathf.Sin(2 * Mathf.PI * p.x + t) + c; }
//complicated multi sine plane, anim private float CSine(Vector3 p, float t, float c) { function = FunctionOption.CSine; //return (0.50f + // 10*( 0.25f * Mathf.Sin(8 * 5 * Mathf.PI * p.x + 4 * t) * Mathf.Sin(4 * 5 * Mathf.PI * p.z + t) + // 0.10f * Mathf.Cos(6 * 5 * Mathf.PI * p.x + 5 * t) * Mathf.Cos(10 * 5 * Mathf.PI * p.z + 3 * t) + // 0.15f * Mathf.Sin(10 * Mathf.PI * p.x + 0.6f * t) + c) ); return (0.50f + (0.25f * Mathf.Sin(4 * Mathf.PI * p.x + 4 * t) * Mathf.Sin(2 * Mathf.PI * p.z + t) + 0.10f * Mathf.Cos(4 * Mathf.PI * p.x + 5 * t) * Mathf.Cos(5 * Mathf.PI * p.z + 3 * t) + 0.15f * Mathf.Sin(Mathf.PI * p.x + 0.6f * t) + c)); }
//cool ripple plane, anim private float Ripple(Vector3 p, float t, float c) { function = FunctionOption.Ripple; p.x -= 0.5f; p.z -= 0.5f; float squareRadius = p.x * p.x + p.z * p.z; return 0.5f + Mathf.Sin(15f * Mathf.PI * squareRadius - 2f * t) / (2f + 100f * squareRadius) + c; }
//need to get bottom half //1sheet hyperboloid, variable dimensions//r = radius, xr = x rad stretch, zr = z rad stretch, yr = y rad stretch private float Sheethyperboloid(Vector3 p, float t, float xr, float zr, float yr, float c) { function = FunctionOption.Sheethyperboloid; p.x = 2f * p.x - 1f; p.z = 2f * p.z - 1f; return Mathf.Sqrt((1f + ((p.z * p.z) / (zr * zr)) - ((p.x * p.x) / (xr * xr)))) * yr + c; }
//paraboloid, variable dim, xr is x radius modifyer, zr is z radius modifier, c is vertical shift,yr is vertical stretch private float Parabola(Vector3 p, float t, float xr, float zr, float yr, float c) { function = FunctionOption.Parabola; p.x = 2f * p.x - 1f; p.z = 2f * p.z - 1f; return c + ((p.x * p.x) / (xr * xr)) + ((p.z * p.z) / (zr * zr)); }
public void TestFunctionFilterOption() { FunctionOption function = FunctionOption.START_WITH; var str = function.ToDescriptionString(); }
public override void Visit(FunctionOption node) { this.action(node); }
/////////animated graphs are below: //1 variable sine plane, anim private float Sine(Vector3 p, float t, float c) { function = FunctionOption.Sine; return(0.5f + 0.5f * Mathf.Sin(2 * Mathf.PI * p.x + t) + c); }
public FunctionFilterExpression(FunctionOption option, QueryKeyValuePair pair) { this.Option = option; this.Pair = pair; }