public InGaAs_Layer(IGeom geom, int layer_no, double alloy_ratio) : base(geom, layer_no) { this.x = alloy_ratio; // re-set material parameters with correct alloy ratio Set_Material_Parameters(); }
public AlGaAs_Layer(IGeom geom, int layer_no, double alloy_ratio) : base(geom, layer_no) { this.x = alloy_ratio; // re-set material parameters with correct alloy ratio Set_Material_Parameters(); }
public void Encapsulate(IGeom geom) { /* * var s = geom.GetBoundingSphere(); * var v = (s.Center - _cent).normalized; * var p1 = this.Project(v); * var p2 = s.Project(v); * var p = p1; * p.Concat(p2); * * _rad = p.Length / 2.0f; * float dot = Vector3.Dot(_cent, p.Axis); * float offset = Mathf.Abs(p.Min - dot); * _cent = (_cent - v * offset) + v * _rad; */ var s = geom.GetBoundingSphere(); var v = s.Center - _cent; var l = v.magnitude; if (l + s.Radius > _rad) { v.Normalize(); _rad = (l + s.Radius + _rad) / 2.0f; _cent += v * (l + s.Radius - _rad); } }
public static bool Intersects(this IGeom geom1, IGeom geom2) { if (geom1 == null || geom2 == null) { return(false); } var s1 = geom1.GetBoundingSphere(); var s2 = geom2.GetBoundingSphere(); if ((s1.Center - s2.Center).magnitude > (s1.Radius + s2.Radius)) { return(false); } foreach (var a in geom1.GetAxes().Union(geom2.GetAxes())) { if (geom1.Project(a).Intersects(geom2.Project(a))) { return(true); } } return(false); }
public void Encapsulate(IGeom geom) { /* var s = geom.GetBoundingSphere(); var v = (s.Center - _cent).normalized; var p1 = this.Project(v); var p2 = s.Project(v); var p = p1; p.Concat(p2); _rad = p.Length / 2.0f; float dot = Vector3.Dot(_cent, p.Axis); float offset = Mathf.Abs(p.Min - dot); _cent = (_cent - v * offset) + v * _rad; */ var s = geom.GetBoundingSphere(); var v = s.Center - _cent; var l = v.magnitude; if (l + s.Radius > _rad) { v.Normalize(); _rad = (l + s.Radius + _rad) / 2.0f; _cent += v * (l + s.Radius - _rad); } }
public static bool Intersects(this IGeom geom, Bounds bounds) { //TODO - re-implement independent of geom, may speed this up var geom2 = new AABBox(bounds); return(Intersects(geom, geom2)); }
public static void ScaleGeom(ref IGeom geom, double scaleX, double scaleY, Point refer) { Matrix mx = new ScaleTransform(scaleX, scaleY, refer.X, refer.Y).Value; Point[] pots = geom.ToPoints(); mx.Transform(pots); geom.SetByPoints(pots); }
public InAlAs_Layer(IGeom geom, int layer_no, double alloy_ratio) : base(geom, layer_no) { // if alloy ratio is below 53% In, this is an indirect band gap material and I don't have the parameters for it if (alloy_ratio < 0.53) throw new NotImplementedException("Error - Below an indium concentration of 53%, the material has an indirect band gap.\nMaterial properties are not implemented for this material"); this.x = alloy_ratio; // re-set material parameters with correct alloy ratio Set_Material_Parameters(); }
public void UpdateGeom() { switch (Type) { case SightType.Cone: _geom = new ViewCone(this.Origin, _targ.forward, SeeDistance, SeeFOV); break; case SightType.Frustum: _geom = new Frustum(this.Origin, _targ.rotation, 0.0f, SeeDistance, SeeFOV, 1.0f); break; } }
public static bool Intersects(this IGeom geom1, IGeom geom2) { if (geom1 == null || geom2 == null) return false; var s1 = geom1.GetBoundingSphere(); var s2 = geom2.GetBoundingSphere(); if ((s1.Center - s2.Center).magnitude > (s1.Radius + s2.Radius)) return false; foreach(var a in geom1.GetAxes().Union(geom2.GetAxes())) { if (geom1.Project(a).Intersects(geom2.Project(a))) return true; } return false; }
//public static void ScaleGraphicVisual(GraphicVisual graphicVisual, Vector scale, Point refer) //{ // if (graphicVisual is GroupVisual) // { // throw new NotImplementedException(); // } // else if (graphicVisual is GeomVisual) // { // Transform tr = new ScaleTransform(scale.X, scale.Y, refer.X, refer.Y); // graphicVisual.Origin = tr.Transform(graphicVisual.Origin); // Vector locScales = Func.VectorRotate(graphicVisual.Angle, scale.X, scale.Y); // GeomVisual gv = graphicVisual as GeomVisual; // IGeom geom = gv.Geom; // GeomHelper.ScaleGeom(ref geom, locScales.X, locScales.Y); // gv.Geom = geom; // } //} public static void ScaleGraphicVisual(GraphicVisual graphicVisual, double scaleX, double scaleY, Point refer) { //ScaleTransform tr = new ScaleTransform(scaleX, scaleY, refer.X, refer.Y); //graphicVisual.Origin = tr.Transform(graphicVisual.Origin); if (graphicVisual is GroupVisual) { throw new NotImplementedException(); } else if (graphicVisual is GeomVisual) { GeomVisual gv = graphicVisual as GeomVisual; IGeom geom = gv.Geom; Point localRefer = gv.Transform.Inverse.Transform(refer); GeomHelper.ScaleGeom(ref geom, scaleX, scaleY, localRefer); gv.Geom = geom; } }
public Al2O3_Layer(IGeom geom, int layer_no) : base(geom, layer_no) { }
public Metal_Layer(IGeom geom, int layer_no) : base(geom, layer_no) { }
private static ILayer Create_Composite_Layer(ILayer default_layer, Dictionary<string, object> data, IGeom default_geom) { int no_components = (int)(double)data["no_components"]; ILayer[] result = new ILayer[no_components]; // set the default layer result[0] = default_layer; // unpack the rest of the composite data Dictionary<int, Dictionary<string, object>> composite_data = new Dictionary<int, Dictionary<string, object>>(); Unpack_CompositeData(composite_data, data, default_geom); // and create the new layers from this for (int i = 1; i < no_components; i++) result[i] = Create_Layer(composite_data[i]); return new Composite_Layer(result, (int)data["layer_no"]); }
public void Invalidate() { _geom = null; }
public PMMA_Layer(IGeom geom, int layer_no) : base(geom, layer_no) { }
static void Unpack_CompositeData(Dictionary <int, Dictionary <string, object> > composite_data, Dictionary <string, object> data, IGeom default_geom) { // cycle over the composite data (minus the default layer) for (int i = 1; i < (int)(double)data["no_components"]; i++) { string[] raw_component_data = ((string)data["component" + i.ToString()]).TrimStart('{').TrimEnd('}').Split(','); Dictionary <string, object> component_data = new Dictionary <string, object>(); // get the component data for (int j = 0; j < raw_component_data.Length; j++) { string tmp_key = raw_component_data[j].Split('=')[0].ToLower(); string tmp_value = raw_component_data[j].Split('=')[1].ToLower(); // try and pass tmp_value by any means possible double d_val; bool b_val; if (double.TryParse(tmp_value, out d_val)) { component_data.Add(tmp_key, d_val); } else if (bool.TryParse(tmp_value, out b_val)) { component_data.Add(tmp_key, b_val); } else { component_data.Add(tmp_key, tmp_value); } } // and add some geometry data component_data.Add("zmin", default_geom.Zmin); component_data.Add("zmax", default_geom.Zmax); component_data.Add("layer_no", i); composite_data[i] = component_data; } }
public GeomVisual(IGeom goem) : this(goem, VisualInfo.Default) { }
public GeomVisual(IGeom goem, VisualInfo graphicInfo) : base(graphicInfo) { _geom = goem; UpdateGraphicInfo(); }
public Substrate_Layer(IGeom geom, int layer_no) : base(geom, layer_no) { }
private static ILayer Create_Composite_Layer(ILayer default_layer, Dictionary <string, object> data, IGeom default_geom) { int no_components = (int)(double)data["no_components"]; ILayer[] result = new ILayer[no_components]; // set the default layer result[0] = default_layer; // unpack the rest of the composite data Dictionary <int, Dictionary <string, object> > composite_data = new Dictionary <int, Dictionary <string, object> >(); Unpack_CompositeData(composite_data, data, default_geom); // and create the new layers from this for (int i = 1; i < no_components; i++) { result[i] = Create_Layer(composite_data[i]); } return(new Composite_Layer(result, (int)data["layer_no"])); }
public Air_Layer(IGeom geom, int layer_no) : base(geom, layer_no) { }
public GaAs_Layer(IGeom geom, int layer_no) : base(geom, layer_no) { }
public Layer(IGeom Geom, int layer_no) { this.layer_no=layer_no; this.geom = Geom; Set_Material_Parameters(); }
static void Unpack_CompositeData(Dictionary<int, Dictionary<string, object>> composite_data, Dictionary<string, object> data, IGeom default_geom) { // cycle over the composite data (minus the default layer) for (int i = 1; i < (int)(double)data["no_components"]; i++) { string[] raw_component_data = ((string)data["component" + i.ToString()]).TrimStart('{').TrimEnd('}').Split(','); Dictionary<string, object> component_data = new Dictionary<string, object>(); // get the component data for (int j = 0; j < raw_component_data.Length; j++) { string tmp_key = raw_component_data[j].Split('=')[0].ToLower(); string tmp_value = raw_component_data[j].Split('=')[1].ToLower(); // try and pass tmp_value by any means possible double d_val; bool b_val; if (double.TryParse(tmp_value, out d_val)) component_data.Add(tmp_key, d_val); else if (bool.TryParse(tmp_value, out b_val)) component_data.Add(tmp_key, b_val); else component_data.Add(tmp_key, tmp_value); } // and add some geometry data component_data.Add("zmin", default_geom.Zmin); component_data.Add("zmax", default_geom.Zmax); component_data.Add("layer_no", i); composite_data[i] = component_data; } }
public Layer(IGeom Geom, int layer_no) { this.layer_no = layer_no; this.geom = Geom; Set_Material_Parameters(); }
public IList <SPoint> GetPoints(IGeom geom) { return(GetPoints(geom.Coors)); }