public PCB_2x2(Compound parent, string name, Vector3D pos, double rot) : base(parent, name, pos, rot) { Material = DefaultMaterial; Material.FillColor = new Material.Color(85, 170, 0, 123); Material.EdgeColor = new Material.Color(12, 62, 153); CutoutMaterial = DefaultCutoutMaterial; CutoutMaterial.FillColor = new Material.Color(0, 85, 0, 123); CutoutMaterial.EdgeColor = new Material.Color(144, 73, 241, 123); LinearPolygon pcb = new LinearPolygon(this, Material, m_priority, 2, 0, new double[, ] { { 0, 41.16, 41.16, 40.22, 40.22, 41.16, 41.16, 1.71, 1.71, 0, 0, 4.73, 4.73, 0 }, { 0, 0, 14.47, 14.47, 24.91, 24.91, 39.66, 39.66, 16.91, 16.91, 14.21, 14.21, 2.76, 2.76 } }, Thickness); m_primitives.Add(pcb); // Cutout for (double xx = 0.0; xx <= 4 * 2.3; xx += 2.3) { for (double yy = 0.0; yy <= 1 * 2.3; yy += 2.3) { Cylinder c = new Cylinder(this, CutoutMaterial, m_cutoutPriority, new Vector3D(xx + 5.55 + 0.84, yy + 3.9 + 0.84, 0.0), new Vector3D(xx + 5.55 + 0.84, yy + 3.9 + 0.84, Thickness), 0.84); m_primitives.Add(c); } } // Shield //m_compounds.Add(new Shield_2x2(this, Name + "-shield", new Vector3D(0, 0, Thickness), 0)); // EPMs m_compounds.Add(new EPM_2x2(this, "epm-1", new Vector3D(-1, 2.8 + 11.33 / 2, -0.62), -Math.PI / 2)); }
public InvertedF_2400MHz(double thickness = 0.0, bool debug = false) : base("Antenna-2400MHz-Inverted-F") { Vector3D feedPoint = new Vector3D(L3 + L4 + L7 + L8 + W2 / 2, 0, 0); m_thickness = thickness; // Antenna Metal copper = new Metal("antenna-inverted-f"); copper.FillColor = new Material.Color(235, 148, 7, 255); copper.EdgeColor = new Material.Color(235, 148, 7, 255); uint priority = 100; uint normDir = 2; double[,] points = new double[, ] { { L3 + L4 + L7, L3 + L4 + L7, L3, L3, L3 + L4 + L5, L3 + L4 + L5, L3 + L4, L3 + L4, L3 + L4 + L7 - 0.1, L3 + L4 + L7 + L8, L3 + L4 + L7 + L8, L3 + L4 + L7 + L8 + W2, L3 + L4 + L7 + L8 + W2, L3 + L4 + L7, L3 + L4 + L7, L1 - L2, L1 - L2, L1, L1, 0, 0, L3 + L4, L3 + L4, L3 + L4 + L5 + 0.2, L3 + L4 + L5 + 0.2, L3 + L4 + L7 - L6 - 0.2, L3 + L4 + L7 - L6 - 0.2 }, { 0, H2 + H3, H2 + H3, H1 + W1 - H4, H1 + W1 - H4, H2 + H3 + H5 + H6, H2 + H3 + H5 + H6, H2 + H3 + H5, H2 + H3 + H5, H2 + H3 + 0.2, 0, 0, H2 + H3 + Math.Sqrt(2) / 2 * W2 + W2 / 4, H2 + H3 + H5 + Math.Sqrt(2) * W2 - 0.08, H1 - H8, H1 - H8, H1, H1, H1 + W1, H1 + W1, H2, H2, 0, 0, H2, H2, 0 } }; m_antenna = new LinearPolygon(null, copper, priority, normDir, 0.0, points, thickness); m_antenna.Move(-feedPoint); // move feedpoint to origin w/o transformations this.Add(m_antenna); if (debug) { // Ground plane placeholders (priority = 0) double groundPlaneWidth = 5.0; Metal groundPlane = new Metal("ground-plane"); groundPlane.FillColor = new Material.Color(235, 148, 7, 255); groundPlane.EdgeColor = new Material.Color(235, 148, 7, 255); //Box groundPlaneLeft = new Box(null, groundPlane, 0, new Vector3D(-W2 / 2 - L8, -groundPlaneWidth, 0), new Vector3D(L3 + L4 + L7, 0, thickness)); Box groundPlaneLeft = new Box(null, groundPlane, 0, new Vector3D(0, -groundPlaneWidth, 0), new Vector3D(L3 + L4 + L7, 0, thickness)); Box groundPlaneRight = new Box(null, groundPlane, 0, new Vector3D(L3 + L4 + L7 + L8 + W2 + L8, -groundPlaneWidth, 0), new Vector3D(L1, 0, thickness)); groundPlaneLeft.Move(-feedPoint); groundPlaneRight.Move(-feedPoint); this.Add(groundPlaneLeft); this.Add(groundPlaneRight); /* * double pcbWidth = 0.56; // FIXME * Box groundPlaneBottom = new Box(null, groundPlane, 0, new Vector3D(0, -groundPlaneWidth, 0-pcbWidth), new Vector3D(L1, 0, thickness-pcbWidth)); * groundPlaneBottom.Move(-feedPoint); * this.Add(groundPlaneBottom); * * // Keep-off region * Dielectric keepOff = new Dielectric("keep-off"); * keepOff.FillColor = new Material.Color(255, 0, 0, 32); * keepOff.EdgeColor = new Material.Color(255, 0, 0, 32); * Box keepOffArea = new Box(null, keepOff, 0, new Vector3D(-1, 0, 0), new Vector3D(L1 + 1, H1 + W1 + 1, thickness)); * keepOffArea.Move(-feedPoint); * this.Add(keepOffArea); */ } }
public Base_1x2(Compound parent, string name, Vector3D pos, double rot) : base(parent, name, pos, rot) { Material.FillColor = new Material.Color(220, 10, 10); Material.EdgeColor = new Material.Color(220, 10, 10); CutoutMaterial = DefaultCutoutMaterial; CutoutMaterial.FillColor = new Material.Color(2, 32, 63, 123); CutoutMaterial.EdgeColor = new Material.Color(2, 32, 63, 123); LinearPolygon lp = new LinearPolygon(this, this.Material, m_priority, 2, 0, new double[, ] { { 43.0, 20.0, 20.0, 0.0, 0.0, 43.0 }, { 1.78, 1.78, 0.0, 0.0, 20.0, 20.0 } }, m_thickness); m_primitives.Add(lp); lp = new LinearPolygon(this, this.Material, m_priority, 2, m_thickness, new double[, ] { { 43.0, 20.0, 20.0, 43.0 - m_width, 43.0 - m_width, 2.65, 2.65, 43.0 }, { 1.78, 1.78, 1.78 + m_width, 1.78 + m_width, 19.96 - m_width, 19.96 - m_width, 20.0, 20.0 } }, m_heightLow); m_primitives.Add(lp); lp = new LinearPolygon(this, this.Material, m_priority, 2, m_thickness, new double[, ] { { m_width, 0.0, 0.0, m_width }, { 16.2, 16.2, 20.0, 20.0 } }, m_heightHigh); m_primitives.Add(lp); lp = new LinearPolygon(this, this.Material, m_priority, 2, m_thickness, new double[, ] { { 20.0, 15.24, 15.24, 20.0 }, { 0.0, 0.0, 1.12, 1.12 } }, m_heightHigh); m_primitives.Add(lp); lp = new LinearPolygon(this, this.Material, m_priority, 2, m_thickness, new double[, ] { { 6.65, 0.0, 0.0, m_width, m_width, 6.65 }, { 0.0, 0.0, 6.65, 6.65, m_width, m_width } }, m_heightHigh); m_primitives.Add(lp); // Cutout Box b = new Box(this, CutoutMaterial, m_cutoutPriority, new Vector3D(5.76, 5.70, 0), new Vector3D(18.0, 11.0, m_thickness)); m_primitives.Add(b); }
public void ImageShouldBeOverlayedPolygonOutlineWithOpacity() { string path = CreateOutputDirectory("Drawing", "LineComplexPolygon"); var simplePath = new LinearPolygon( new Vector2(10, 10), new Vector2(200, 150), new Vector2(50, 300)); var hole1 = new LinearPolygon( new Vector2(37, 85), new Vector2(93, 85), new Vector2(65, 137)); var color = new Color(Color.HotPink.R, Color.HotPink.G, Color.HotPink.B, 150); var image = new Image(500, 500); using (FileStream output = File.OpenWrite($"{path}/Opacity.png")) { image .BackgroundColor(Color.Blue) .DrawPolygon(color, 5, new ComplexPolygon(simplePath, hole1)) .Save(output); } //shift background color towards forground color by the opacity amount var mergedColor = new Color(Vector4.Lerp(Color.Blue.ToVector4(), Color.HotPink.ToVector4(), 150f / 255f)); using (var sourcePixels = image.Lock()) { Assert.Equal(mergedColor, sourcePixels[10, 10]); Assert.Equal(mergedColor, sourcePixels[200, 150]); Assert.Equal(mergedColor, sourcePixels[50, 300]); Assert.Equal(mergedColor, sourcePixels[37, 85]); Assert.Equal(mergedColor, sourcePixels[93, 85]); Assert.Equal(mergedColor, sourcePixels[65, 137]); Assert.Equal(Color.Blue, sourcePixels[2, 2]); //inside hole Assert.Equal(Color.Blue, sourcePixels[57, 99]); //inside shape Assert.Equal(Color.Blue, sourcePixels[100, 192]); } }
public Small_15x6mm_2400MHz(double thickness = 0.01) : base("Patch-antenna-2400MHz-15x6mm") { Vector3D feedPoint = new Vector3D(W1 + D5 + W2 / 2, D4 / 2, 0.0); Metal copper = new Metal("copper"); copper.FillColor = new Material.Color(235, 148, 7, 255); copper.EdgeColor = new Material.Color(235, 148, 7, 255); uint priority = 100; uint normDir = 2; m_thickness = thickness; double[,] points = new double[, ] { { 0, 0 }, { W1, 0 }, { W1, L6 }, { W1 + D5, L6 }, { W1 + D5, 0 }, { W1 + D5 + W2, 0 }, { W1 + D5 + W2, L6 }, { L3 - W2, L6 }, { L3 - W2, L6 - L4 }, { L3 + L5 + W2, L6 - L4 }, { L3 + L5 + W2, L6 }, { L3 + L5 + L2 - W2, L6 }, { L3 + L5 + L2 - W2, L6 - L4 }, { L3 + L5 + L2 + L5 + W2, L6 - L4 }, { L3 + L5 + L2 + L5 + W2, L6 }, { L3 + L5 + L2 + L5 + L2 - W2, L6 }, { L3 + L5 + L2 + L5 + L2 - W2, L6 - L1 }, { L3 + L5 + L2 + L5 + L2, L6 - L1 }, { L3 + L5 + L2 + L5 + L2, L6 + W2 }, { L3 + L5 + L2 + L5, L6 + W2 }, { L3 + L5 + L2 + L5, L6 - L4 + W2 }, { L3 + L5 + L2, L6 - L4 + W2 }, { L3 + L5 + L2, L6 + W2 }, { L3 + L5, L6 + W2 }, { L3 + L5, L6 - L4 + W2 }, { L3, L6 - L4 + W2 }, { L3, L6 + W2 }, { 0, L6 + W2 } }; m_antenna = new LinearPolygon(null, copper, priority, normDir, 0.0, points, thickness); m_antenna.Move(-feedPoint); this.Add(m_antenna); }
public Alnico(Compound parent, string name, Vector3D pos, double rot) : base(parent, name, pos, rot) { Priority = EPM.m_priority; Material = DefaultMaterial; Material.FillColor = new Material.Color(55, 55, 65, 255); Material.EdgeColor = new Material.Color(55, 55, 65, 255); LinearPolygon alnico = new LinearPolygon(this, Material, Priority, 0, 0, new double[, ] { { 2.6, 2.6, 5.11, 5.11 }, { 0.91, 2.38, 2.38, 0.91 } }, m_width); m_primitives.Add(alnico); }
public Neodymium(Compound parent, string name, Vector3D pos, double rot) : base(parent, name, pos, rot) { Priority = EPM.m_priority; Material = DefaultMaterial; Material.FillColor = new Material.Color(55, 55, 65, 255); Material.EdgeColor = new Material.Color(55, 55, 65, 255); LinearPolygon neodymium = new LinearPolygon(this, this.Material, this.Priority, 0, 0, new double[, ] { { 0, 0, 2, 2 }, { 0, 2.38, 2.38, 0 } }, m_width); m_primitives.Add(neodymium); }
public Coil(Compound parent, string name, Vector3D pos, double rot) : base(parent, name, pos, rot) { Priority = EPM.m_priority - 1; Material = DefaultMaterial; Material.FillColor = new Material.Color(235, 148, 7, 255); Material.EdgeColor = new Material.Color(235, 148, 7, 255); LinearPolygon neodymium = new LinearPolygon(this, this.Material, this.Priority, 0, m_d, new double[, ] { { 2.6 - m_thickness, 2.6 - m_thickness, 5.11 + m_thickness, 5.11 + m_thickness }, { 0.91 - m_thickness, 2.38 + m_thickness, 2.38 + m_thickness, 0.91 - m_thickness } }, m_width - 2 * m_d); m_primitives.Add(neodymium); }
public Pole(Compound parent, string name, Vector3D pos, double rot, double width) : base(parent, name, pos, rot) { m_width = width; Priority = EPM.m_priority; Material = DefaultMaterial; Material.FillColor = new Material.Color(95, 95, 95, 255); Material.EdgeColor = new Material.Color(95, 95, 95, 255); LinearPolygon pole = new LinearPolygon(this, this.Material, this.Priority, 0, 0, new double[, ] { { 0, 0, 5.11, 5.11, 3.59, 2.2 }, { 0, 2.38, 2.38, 0.91, 0.91, 0 } }, m_width); m_primitives.Add(pole); }
public void ImageShouldBeOverlayedByPolygonOutlineNoOverlapping() { string path = CreateOutputDirectory("Drawing", "LineComplexPolygon"); var simplePath = new LinearPolygon( new Vector2(10, 10), new Vector2(200, 150), new Vector2(50, 300)); var hole1 = new LinearPolygon( new Vector2(207, 25), new Vector2(263, 25), new Vector2(235, 57)); var image = new Image(500, 500); using (FileStream output = File.OpenWrite($"{path}/SimpleVanishHole.png")) { image .BackgroundColor(Color.Blue) .DrawPolygon(Color.HotPink, 5, new ComplexPolygon(simplePath, hole1)) .Save(output); } using (var sourcePixels = image.Lock()) { Assert.Equal(Color.HotPink, sourcePixels[10, 10]); Assert.Equal(Color.HotPink, sourcePixels[200, 150]); Assert.Equal(Color.HotPink, sourcePixels[50, 300]); //Assert.Equal(Color.HotPink, sourcePixels[37, 85]); //Assert.Equal(Color.HotPink, sourcePixels[93, 85]); //Assert.Equal(Color.HotPink, sourcePixels[65, 137]); Assert.Equal(Color.Blue, sourcePixels[2, 2]); //inside hole Assert.Equal(Color.Blue, sourcePixels[57, 99]); //inside shape Assert.Equal(Color.Blue, sourcePixels[100, 192]); } }
public Base_2x2(Compound parent, string name, Vector3D pos, double rot) : base(parent, name, pos, rot) { this.Material.FillColor = new Material.Color(220, 10, 10); this.Material.EdgeColor = new Material.Color(220, 10, 10); CutoutMaterial = DefaultCutoutMaterial; CutoutMaterial.FillColor = new Material.Color(2, 32, 63, 123); CutoutMaterial.EdgeColor = new Material.Color(2, 32, 63, 123); LinearPolygon lp = new LinearPolygon(this, this.Material, m_priority, 2, 0, new double[, ] { { 0, 43, 43, 1.8, 1.8, 0 }, { 0, 0, 41.2, 41.2, 18.3, 18.3 } }, m_thickness); m_primitives.Add(lp); lp = new LinearPolygon(this, this.Material, m_priority, 2, m_thickness, new double[, ] { { 0, 43, 43, 1.8, 1.8, 1.8 + m_width, 1.8 + m_width, 43 - m_width, 43 - m_width, 0 }, { 0, 0, 41.2, 41.2, 19.2, 19.2, 41.2 - m_width, 41.2 - m_width, m_width, m_width } }, m_heightLow); m_primitives.Add(lp); lp = new LinearPolygon(this, this.Material, m_priority, 2, m_thickness, new double[, ] { { 0, m_widthWide, m_widthWide, 0 }, { 0, 0, 3.45, 3.45 } }, m_heightHigh); m_primitives.Add(lp); lp = new LinearPolygon(this, this.Material, m_priority, 2, m_thickness, new double[, ] { { 0, m_widthWide, m_widthWide, 0 }, { 14.85, 14.85, 14.85 + 3.45, 14.85 + 3.45 } }, m_heightHigh); m_primitives.Add(lp); // Cutout Box b = new Box(this, CutoutMaterial, m_cutoutPriority, new Vector3D(5.72, 3.9, 0), new Vector3D(18, 9.21, m_thickness)); m_primitives.Add(b); }
public void ImageShouldBeOverlayedPolygonOutlineWithOverlap() { string path = CreateOutputDirectory("Drawing", "ComplexPolygon"); var simplePath = new LinearPolygon( new Vector2(10, 10), new Vector2(200, 150), new Vector2(50, 300)); var hole1 = new LinearPolygon( new Vector2(37, 85), new Vector2(130, 40), new Vector2(65, 137)); var image = new Image(500, 500); using (FileStream output = File.OpenWrite($"{path}/SimpleOverlapping.png")) { image .BackgroundColor(Color.Blue) .Fill(Color.HotPink, new ComplexPolygon(simplePath, hole1)) .Save(output); } using (var sourcePixels = image.Lock()) { Assert.Equal(Color.HotPink, sourcePixels[11, 11]); Assert.Equal(Color.HotPink, sourcePixels[200, 150]); Assert.Equal(Color.HotPink, sourcePixels[50, 50]); Assert.Equal(Color.HotPink, sourcePixels[35, 100]); Assert.Equal(Color.Blue, sourcePixels[2, 2]); //inside hole Assert.Equal(Color.Blue, sourcePixels[57, 99]); } }
public void ImageShouldBeOverlayedByPolygonOutlineDashed() { string path = CreateOutputDirectory("Drawing", "LineComplexPolygon"); var simplePath = new LinearPolygon( new Vector2(10, 10), new Vector2(200, 150), new Vector2(50, 300)); var hole1 = new LinearPolygon( new Vector2(37, 85), new Vector2(93, 85), new Vector2(65, 137)); var image = new Image(500, 500); using (FileStream output = File.OpenWrite($"{path}/Dashed.png")) { image .BackgroundColor(Color.Blue) .DrawPolygon(Pens.Dash(Color.HotPink, 5), new ComplexPolygon(simplePath, hole1)) .Save(output); } }
public PCB_1x2(Compound parent, string name, Vector3D pos, double rot) : base(parent, name, pos, rot) { Material = DefaultMaterial; Material.FillColor = new Material.Color(85, 170, 0, 123); Material.EdgeColor = new Material.Color(12, 62, 153); CutoutMaterial = DefaultCutoutMaterial; CutoutMaterial.FillColor = new Material.Color(0, 85, 0, 123); CutoutMaterial.EdgeColor = new Material.Color(144, 73, 241, 123); LinearPolygon pcb = new LinearPolygon(this, Material, m_priority, 2, 0, new double[, ] { { 40.5, 40.5, 18.5, 18.5, 14.2, 14.2, 5.2, 5.2, 0.0, 0.0, 4.0, 4.0, 0.0, 0.0 }, { 18.0, 1.4, 1.4, 0.0, 0.0, 4.0, 4.0, 0.0, 0.0, 5.26, 5.26, 14.05, 14.05, 18.0 } }, Thickness); m_primitives.Add(pcb); // Cutout for (double xx = 0.0; xx <= 4 * 2.3; xx += 2.3) { foreach (double yy in new double[] { 0, 2.3 }) { Cylinder c = new Cylinder(this, CutoutMaterial, m_cutoutPriority, new Vector3D(xx + 5.14 + 0.84, yy + 5.21 + 0.84, 0.0), new Vector3D(xx + 5.14 + 0.84, yy + 5.21 + 0.84, Thickness), 0.84); m_primitives.Add(c); } } // Shield //m_compounds.Add(new Shield_1x2(this, Name + "-shield", new Vector3D(0, 0, Thickness), 0)); // EPMs m_compounds.Add(new EPM_1x2(this, "epm-1", new Vector3D(5.45 + 8.5 / 2, -1.2, -0.62), 0)); m_compounds.Add(new EPM_1x2(this, "epm-2", new Vector3D(-1.2, 9.69, -0.62), -Math.PI / 2)); }
public Small_15x6mm_2400MHz(double thickness = 0.01) : base("Patch-antenna-2400MHz-15x6mm") { Vector3D feedPoint = new Vector3D(W1 + D5 + W2 / 2, D4 / 2, 0.0); Metal copper = new Metal("copper"); copper.FillColor = new Material.Color(235, 148, 7, 255); copper.EdgeColor = new Material.Color(235, 148, 7, 255); uint priority = 100; uint normDir = 2; m_thickness = thickness; double[,] points = new double[,] { {0, 0}, {W1, 0}, {W1, L6}, {W1+D5, L6}, {W1+D5, 0}, {W1+D5+W2, 0}, {W1+D5+W2, L6}, {L3-W2, L6}, {L3-W2, L6-L4}, {L3+L5+W2, L6-L4}, {L3+L5+W2, L6}, {L3+L5+L2-W2, L6}, {L3+L5+L2-W2, L6-L4}, {L3+L5+L2+L5+W2, L6-L4}, {L3+L5+L2+L5+W2, L6}, {L3+L5+L2+L5+L2-W2, L6}, {L3+L5+L2+L5+L2-W2, L6-L1}, {L3+L5+L2+L5+L2, L6-L1}, {L3+L5+L2+L5+L2, L6+W2}, {L3+L5+L2+L5, L6+W2}, {L3+L5+L2+L5, L6-L4+W2}, {L3+L5+L2, L6-L4+W2}, {L3+L5+L2, L6+W2}, {L3+L5, L6+W2}, {L3+L5, L6-L4+W2}, {L3, L6-L4+W2}, {L3, L6+W2}, {0, L6+W2} }; m_antenna = new LinearPolygon(null, copper, priority, normDir, 0.0, points, thickness); m_antenna.Move(-feedPoint); this.Add(m_antenna); }
public Shield_1x2(Compound parent, string name, Vector3D pos, double rot) : base(parent, name, pos, rot) { // Top LinearPolygon shield = new LinearPolygon(this, Material, m_priority, 2, m_height-m_thickness, new double[,] { { 0.68, 0.68, 4.45, 4.45, 0.68, 0.68, 39.82, 39.82, 17.52, 17.52, 14.1, 14.1, 5.3, 5.3 }, { 0.68, 5.3, 5.3, 14.1, 14.1, 17.32, 17.32, 2.08, 2.08, 0.68, 0.68, 4.45, 4.45, 0.68} }, m_thickness); m_primitives.Add(shield); // West pads double width = 1.73; double x = 0.68; foreach (double yy in LinSpace(0.68 + width / 2, 5.3 - width / 2, 2)) { m_primitives.AddRange(base.Pad(width, new Vector3D(x, yy, 0), -Math.PI / 2)); } width = 3; x = 0.68; double y = 14.1 + width / 2; m_primitives.AddRange(base.Pad(width, new Vector3D(x, y, 0), -Math.PI / 2)); // North pads width = 3; y = 17.32; foreach (double xx in LinSpace(0.68 + width / 2, 39.82 - width / 2, 10)) { m_primitives.AddRange(base.Pad(width, new Vector3D(xx, y, 0), -Math.PI)); } // East pads width = 3; x = 39.82; foreach (double yy in LinSpace(2.08 + width / 2, 17.32 - width / 2, 4)) { m_primitives.AddRange(base.Pad(width, new Vector3D(x, yy, 0), Math.PI / 2)); } // South pads width = 3; y = 2.08; foreach (double xx in LinSpace(24.5 + width / 2, 39.82 - width / 2, 4)) { m_primitives.AddRange(base.Pad(width, new Vector3D(xx, y, 0), 0)); } width = 4.42; x = 19.08 + width / 2; y = 2.08; m_primitives.AddRange(base.Pad(width, new Vector3D(x, y, 0), 0)); width = 1.25; y = 0.68; foreach (double xx in LinSpace(14.1 + width / 2, 17.52 - width / 2, 2)) { m_primitives.AddRange(base.Pad(width, new Vector3D(xx, y, 0), 0)); } width = 1.73; y = 0.68; foreach (double xx in LinSpace(0.68 + width / 2, 5.3 - width / 2, 2)) { m_primitives.AddRange(base.Pad(width, new Vector3D(xx, y, 0), 0)); } }
public Shield_2x2(Compound parent, string name, Vector3D pos, double rot) : base(parent, name, pos, rot) { // Top LinearPolygon shield = new LinearPolygon(this, Material, m_priority, 2, m_height - m_thickness, new double[,] { { 0.68, 40.33, 40.33, 39.38, 39.38, 40.33, 40.33, 2.68, 2.68, 0.68, 0.68, 4.82, 4.82, 0.68}, { 0.68, 0.68, 14.03, 14.03, 25.18, 25.18, 38.83, 38.83, 15.83, 15.83, 14.21, 14.21, 2.61, 2.61 } }, m_thickness); m_primitives.Add(shield); // West pads double width, x, y; width = 3; x = 2.68; foreach (double yy in LinSpace(38.15 + 0.68 - width / 2, 0.68 + 15.15 + 1 + width / 2, 6)) { m_primitives.AddRange(base.Pad(width, new Vector3D(x, yy, 0), -Math.PI / 2)); } width = 1.71; x = 2.68; y = 0.68 + 16.62 + width / 2; m_primitives.AddRange(base.Pad(width, new Vector3D(x, y, 0), -Math.PI / 2)); width = 1.63; y = 0.68 + 13.52 + width / 2; x = 0.68; m_primitives.AddRange(base.Pad(width, new Vector3D(x, y, 0), -Math.PI / 2)); width = 1.93; y = 0.68 + width / 2; x = 0.68; m_primitives.AddRange(base.Pad(width, new Vector3D(x, y, 0), -Math.PI / 2)); // North pads width = 3; y = 38.15 + 0.68; foreach (double xx in LinSpace(39.15 + 0.68 - width / 2, 2 + width / 2 + 0.68, 10)) { m_primitives.AddRange(base.Pad(width, new Vector3D(xx, y, 0), Math.PI)); } // East pads width = 3; x = 0.68 + 39.65; foreach (double yy in LinSpace(0.68 + width / 2, 0.68 + 4 + width / 2, 2)) { m_primitives.AddRange(base.Pad(width, new Vector3D(x, yy, 0), Math.PI / 2)); } width = 5.35; y = 8.68 + width / 2; m_primitives.AddRange(base.Pad(width, new Vector3D(x, y, 0), Math.PI / 2)); width = 2.3; x = 0.68 + 38.7; foreach (double yy in LinSpace(0.68 + 13.35 + 1 + width / 2, 0.68 + 24.5 - 1 - width / 2, 3)) { m_primitives.AddRange(base.Pad(width, new Vector3D(x, yy, 0), Math.PI / 2)); } width = 3.8; x = 0.68 + 39.65; foreach (double yy in LinSpace(0.68 + 24.5 + width / 2, 0.68 + 38.15 - width / 2, 3)) { m_primitives.AddRange(base.Pad(width, new Vector3D(x, yy, 0), Math.PI / 2)); } // South pads width = 3; y = 0.68; foreach (double xx in LinSpace(0.68 + width / 2, 39.65 + 0.68 - width / 2, 10)) { m_primitives.AddRange(base.Pad(width, new Vector3D(xx, y, 0), 0)); } }
public Pole(Compound parent, string name, Vector3D pos, double rot, double width) : base(parent, name, pos, rot) { m_width = width; Priority = EPM.m_priority; Material = DefaultMaterial; Material.FillColor = new Material.Color(95, 95, 95, 255); Material.EdgeColor = new Material.Color(95, 95, 95, 255); LinearPolygon pole = new LinearPolygon(this, this.Material, this.Priority, 0, 0, new double[,] { { 0, 0, 5.11, 5.11, 3.59, 2.2 }, { 0, 2.38, 2.38, 0.91, 0.91, 0} }, m_width); m_primitives.Add(pole); }
public Alnico(Compound parent, string name, Vector3D pos, double rot) : base(parent, name, pos, rot) { Priority = EPM.m_priority; Material = DefaultMaterial; Material.FillColor = new Material.Color(55, 55, 65, 255); Material.EdgeColor = new Material.Color(55, 55, 65, 255); LinearPolygon alnico = new LinearPolygon(this, Material, Priority, 0, 0, new double[,] { { 2.6, 2.6, 5.11, 5.11 }, { 0.91, 2.38, 2.38, 0.91} }, m_width); m_primitives.Add(alnico); }
public Neodymium(Compound parent, string name, Vector3D pos, double rot) : base(parent, name, pos, rot) { Priority = EPM.m_priority; Material = DefaultMaterial; Material.FillColor = new Material.Color(55, 55, 65, 255); Material.EdgeColor = new Material.Color(55, 55, 65, 255); LinearPolygon neodymium = new LinearPolygon(this, this.Material, this.Priority, 0, 0, new double[,] { { 0, 0, 2, 2 }, { 0, 2.38, 2.38, 0} }, m_width); m_primitives.Add(neodymium); }
public Coil(Compound parent, string name, Vector3D pos, double rot) : base(parent, name, pos, rot) { Priority = EPM.m_priority - 1; Material = DefaultMaterial; Material.FillColor = new Material.Color(235, 148, 7, 255); Material.EdgeColor = new Material.Color(235, 148, 7, 255); LinearPolygon neodymium = new LinearPolygon(this, this.Material, this.Priority, 0, m_d, new double[,] { { 2.6 - m_thickness, 2.6 - m_thickness, 5.11 + m_thickness, 5.11 + m_thickness }, { 0.91 - m_thickness, 2.38 + m_thickness, 2.38 + m_thickness, 0.91 - m_thickness} }, m_width-2*m_d); m_primitives.Add(neodymium); }
public Shield_2x2(Compound parent, string name, Vector3D pos, double rot) : base(parent, name, pos, rot) { // Top LinearPolygon shield = new LinearPolygon(this, Material, m_priority, 2, m_height - m_thickness, new double[, ] { { 0.68, 40.33, 40.33, 39.38, 39.38, 40.33, 40.33, 2.68, 2.68, 0.68, 0.68, 4.82, 4.82, 0.68 }, { 0.68, 0.68, 14.03, 14.03, 25.18, 25.18, 38.83, 38.83, 15.83, 15.83, 14.21, 14.21, 2.61, 2.61 } }, m_thickness); m_primitives.Add(shield); // West pads double width, x, y; width = 3; x = 2.68; foreach (double yy in LinSpace(38.15 + 0.68 - width / 2, 0.68 + 15.15 + 1 + width / 2, 6)) { m_primitives.AddRange(base.Pad(width, new Vector3D(x, yy, 0), -Math.PI / 2)); } width = 1.71; x = 2.68; y = 0.68 + 16.62 + width / 2; m_primitives.AddRange(base.Pad(width, new Vector3D(x, y, 0), -Math.PI / 2)); width = 1.63; y = 0.68 + 13.52 + width / 2; x = 0.68; m_primitives.AddRange(base.Pad(width, new Vector3D(x, y, 0), -Math.PI / 2)); width = 1.93; y = 0.68 + width / 2; x = 0.68; m_primitives.AddRange(base.Pad(width, new Vector3D(x, y, 0), -Math.PI / 2)); // North pads width = 3; y = 38.15 + 0.68; foreach (double xx in LinSpace(39.15 + 0.68 - width / 2, 2 + width / 2 + 0.68, 10)) { m_primitives.AddRange(base.Pad(width, new Vector3D(xx, y, 0), Math.PI)); } // East pads width = 3; x = 0.68 + 39.65; foreach (double yy in LinSpace(0.68 + width / 2, 0.68 + 4 + width / 2, 2)) { m_primitives.AddRange(base.Pad(width, new Vector3D(x, yy, 0), Math.PI / 2)); } width = 5.35; y = 8.68 + width / 2; m_primitives.AddRange(base.Pad(width, new Vector3D(x, y, 0), Math.PI / 2)); width = 2.3; x = 0.68 + 38.7; foreach (double yy in LinSpace(0.68 + 13.35 + 1 + width / 2, 0.68 + 24.5 - 1 - width / 2, 3)) { m_primitives.AddRange(base.Pad(width, new Vector3D(x, yy, 0), Math.PI / 2)); } width = 3.8; x = 0.68 + 39.65; foreach (double yy in LinSpace(0.68 + 24.5 + width / 2, 0.68 + 38.15 - width / 2, 3)) { m_primitives.AddRange(base.Pad(width, new Vector3D(x, yy, 0), Math.PI / 2)); } // South pads width = 3; y = 0.68; foreach (double xx in LinSpace(0.68 + width / 2, 39.65 + 0.68 - width / 2, 10)) { m_primitives.AddRange(base.Pad(width, new Vector3D(xx, y, 0), 0)); } }
public PCB_2x2(Compound parent, string name, Vector3D pos, double rot) : base(parent, name, pos, rot) { Material = DefaultMaterial; Material.FillColor = new Material.Color(85, 170, 0, 123); Material.EdgeColor = new Material.Color(12, 62, 153); CutoutMaterial = DefaultCutoutMaterial; CutoutMaterial.FillColor = new Material.Color(0, 85, 0, 123); CutoutMaterial.EdgeColor = new Material.Color(144, 73, 241, 123); LinearPolygon pcb = new LinearPolygon(this, Material, m_priority, 2, 0, new double[,] { { 0, 41.16, 41.16, 40.22, 40.22, 41.16, 41.16, 1.71, 1.71, 0, 0, 4.73, 4.73, 0 }, { 0, 0, 14.47, 14.47, 24.91, 24.91, 39.66, 39.66, 16.91, 16.91, 14.21, 14.21, 2.76, 2.76 } }, Thickness); m_primitives.Add(pcb); // Cutout for (double xx = 0.0; xx <= 4 * 2.3; xx += 2.3) { for (double yy = 0.0; yy <= 1 * 2.3; yy += 2.3) { Cylinder c = new Cylinder(this, CutoutMaterial, m_cutoutPriority, new Vector3D(xx + 5.55 + 0.84, yy + 3.9 + 0.84, 0.0), new Vector3D(xx + 5.55 + 0.84, yy + 3.9 + 0.84, Thickness), 0.84); m_primitives.Add(c); } } // Shield //m_compounds.Add(new Shield_2x2(this, Name + "-shield", new Vector3D(0, 0, Thickness), 0)); // EPMs m_compounds.Add(new EPM_2x2(this, "epm-1", new Vector3D(-1, 2.8 + 11.33 / 2, -0.62), -Math.PI / 2)); }
public InvertedF_2400MHz(double thickness = 0.0, bool debug = false) : base("Antenna-2400MHz-Inverted-F") { Vector3D feedPoint = new Vector3D(L3 + L4 + L7 + L8 + W2 / 2, 0, 0); m_thickness = thickness; // Antenna Metal copper = new Metal("antenna-inverted-f"); copper.FillColor = new Material.Color(235, 148, 7, 255); copper.EdgeColor = new Material.Color(235, 148, 7, 255); uint priority = 100; uint normDir = 2; double[,] points = new double[,] { { L3+L4+L7, L3+L4+L7, L3, L3, L3+L4+L5, L3+L4+L5, L3+L4, L3+L4, L3+L4+L7-0.1, L3+L4+L7+L8, L3+L4+L7+L8, L3+L4+L7+L8+W2, L3+L4+L7+L8+W2, L3+L4+L7, L3+L4+L7, L1-L2, L1-L2, L1, L1, 0, 0, L3+L4, L3+L4, L3+L4+L5+0.2, L3+L4+L5+0.2, L3+L4+L7-L6-0.2, L3+L4+L7-L6-0.2 }, { 0, H2+H3, H2+H3, H1+W1-H4, H1+W1-H4, H2+H3+H5+H6, H2+H3+H5+H6, H2+H3+H5, H2+H3+H5, H2+H3 + 0.2, 0, 0, H2+H3+Math.Sqrt(2)/2*W2 + W2/4, H2+H3+H5+Math.Sqrt(2)*W2 -0.08, H1-H8, H1-H8, H1, H1, H1+W1, H1+W1, H2, H2, 0, 0, H2, H2, 0 } }; m_antenna = new LinearPolygon(null, copper, priority, normDir, 0.0, points, thickness); m_antenna.Move(-feedPoint); // move feedpoint to origin w/o transformations this.Add(m_antenna); if (debug) { // Ground plane placeholders (priority = 0) double groundPlaneWidth = 5.0; Metal groundPlane = new Metal("ground-plane"); groundPlane.FillColor = new Material.Color(235, 148, 7, 255); groundPlane.EdgeColor = new Material.Color(235, 148, 7, 255); //Box groundPlaneLeft = new Box(null, groundPlane, 0, new Vector3D(-W2 / 2 - L8, -groundPlaneWidth, 0), new Vector3D(L3 + L4 + L7, 0, thickness)); Box groundPlaneLeft = new Box(null, groundPlane, 0, new Vector3D(0, -groundPlaneWidth, 0), new Vector3D(L3 + L4 + L7, 0, thickness)); Box groundPlaneRight = new Box(null, groundPlane, 0, new Vector3D(L3 + L4 + L7 + L8 + W2 + L8, -groundPlaneWidth, 0), new Vector3D(L1, 0, thickness)); groundPlaneLeft.Move(-feedPoint); groundPlaneRight.Move(-feedPoint); this.Add(groundPlaneLeft); this.Add(groundPlaneRight); /* double pcbWidth = 0.56; // FIXME Box groundPlaneBottom = new Box(null, groundPlane, 0, new Vector3D(0, -groundPlaneWidth, 0-pcbWidth), new Vector3D(L1, 0, thickness-pcbWidth)); groundPlaneBottom.Move(-feedPoint); this.Add(groundPlaneBottom); // Keep-off region Dielectric keepOff = new Dielectric("keep-off"); keepOff.FillColor = new Material.Color(255, 0, 0, 32); keepOff.EdgeColor = new Material.Color(255, 0, 0, 32); Box keepOffArea = new Box(null, keepOff, 0, new Vector3D(-1, 0, 0), new Vector3D(L1 + 1, H1 + W1 + 1, thickness)); keepOffArea.Move(-feedPoint); this.Add(keepOffArea); */ } }
public Base_2x2(Compound parent, string name, Vector3D pos, double rot) : base(parent, name, pos, rot) { this.Material.FillColor = new Material.Color(220, 10, 10); this.Material.EdgeColor = new Material.Color(220, 10, 10); CutoutMaterial = DefaultCutoutMaterial; CutoutMaterial.FillColor = new Material.Color(2, 32, 63, 123); CutoutMaterial.EdgeColor = new Material.Color(2, 32, 63, 123); LinearPolygon lp = new LinearPolygon(this, this.Material, m_priority, 2, 0, new double[,] { { 0, 43, 43, 1.8, 1.8, 0 }, { 0, 0, 41.2, 41.2, 18.3, 18.3 } }, m_thickness); m_primitives.Add(lp); lp = new LinearPolygon(this, this.Material, m_priority, 2, m_thickness, new double[,] { {0, 43, 43, 1.8, 1.8, 1.8+m_width, 1.8+m_width, 43-m_width, 43-m_width, 0}, {0, 0, 41.2, 41.2, 19.2, 19.2, 41.2-m_width, 41.2-m_width, m_width, m_width} }, m_heightLow); m_primitives.Add(lp); lp = new LinearPolygon(this, this.Material, m_priority, 2, m_thickness, new double[,] { { 0, m_widthWide, m_widthWide, 0 }, { 0, 0, 3.45, 3.45 } }, m_heightHigh); m_primitives.Add(lp); lp = new LinearPolygon(this, this.Material, m_priority, 2, m_thickness, new double[,] { { 0, m_widthWide, m_widthWide, 0 }, { 14.85, 14.85, 14.85+3.45, 14.85+3.45 } }, m_heightHigh); m_primitives.Add(lp); // Cutout Box b = new Box(this, CutoutMaterial, m_cutoutPriority, new Vector3D(5.72, 3.9, 0), new Vector3D(18, 9.21, m_thickness)); m_primitives.Add(b); }
public PCB_1x2(Compound parent, string name, Vector3D pos, double rot) : base(parent, name, pos, rot) { Material = DefaultMaterial; Material.FillColor = new Material.Color(85, 170, 0, 123); Material.EdgeColor = new Material.Color(12, 62, 153); CutoutMaterial = DefaultCutoutMaterial; CutoutMaterial.FillColor = new Material.Color(0, 85, 0, 123); CutoutMaterial.EdgeColor = new Material.Color(144, 73, 241, 123); LinearPolygon pcb = new LinearPolygon(this, Material, m_priority, 2, 0, new double[,] { { 40.5, 40.5, 18.5, 18.5, 14.2, 14.2, 5.2, 5.2, 0.0, 0.0, 4.0, 4.0, 0.0, 0.0 }, { 18.0, 1.4, 1.4, 0.0, 0.0, 4.0, 4.0, 0.0, 0.0, 5.26, 5.26, 14.05, 14.05, 18.0} }, Thickness); m_primitives.Add(pcb); // Cutout for (double xx = 0.0; xx <= 4 * 2.3; xx += 2.3) { foreach (double yy in new double[] { 0, 2.3 }) { Cylinder c = new Cylinder(this, CutoutMaterial, m_cutoutPriority, new Vector3D ( xx + 5.14 + 0.84, yy + 5.21 + 0.84, 0.0 ), new Vector3D ( xx + 5.14 + 0.84, yy + 5.21 + 0.84, Thickness ), 0.84); m_primitives.Add(c); } } // Shield //m_compounds.Add(new Shield_1x2(this, Name + "-shield", new Vector3D(0, 0, Thickness), 0)); // EPMs m_compounds.Add(new EPM_1x2(this, "epm-1", new Vector3D(5.45 + 8.5 / 2, -1.2, -0.62), 0)); m_compounds.Add(new EPM_1x2(this, "epm-2", new Vector3D(-1.2, 9.69, -0.62), -Math.PI / 2)); }
public Shield_1x2(Compound parent, string name, Vector3D pos, double rot) : base(parent, name, pos, rot) { // Top LinearPolygon shield = new LinearPolygon(this, Material, m_priority, 2, m_height - m_thickness, new double[, ] { { 0.68, 0.68, 4.45, 4.45, 0.68, 0.68, 39.82, 39.82, 17.52, 17.52, 14.1, 14.1, 5.3, 5.3 }, { 0.68, 5.3, 5.3, 14.1, 14.1, 17.32, 17.32, 2.08, 2.08, 0.68, 0.68, 4.45, 4.45, 0.68 } }, m_thickness); m_primitives.Add(shield); // West pads double width = 1.73; double x = 0.68; foreach (double yy in LinSpace(0.68 + width / 2, 5.3 - width / 2, 2)) { m_primitives.AddRange(base.Pad(width, new Vector3D(x, yy, 0), -Math.PI / 2)); } width = 3; x = 0.68; double y = 14.1 + width / 2; m_primitives.AddRange(base.Pad(width, new Vector3D(x, y, 0), -Math.PI / 2)); // North pads width = 3; y = 17.32; foreach (double xx in LinSpace(0.68 + width / 2, 39.82 - width / 2, 10)) { m_primitives.AddRange(base.Pad(width, new Vector3D(xx, y, 0), -Math.PI)); } // East pads width = 3; x = 39.82; foreach (double yy in LinSpace(2.08 + width / 2, 17.32 - width / 2, 4)) { m_primitives.AddRange(base.Pad(width, new Vector3D(x, yy, 0), Math.PI / 2)); } // South pads width = 3; y = 2.08; foreach (double xx in LinSpace(24.5 + width / 2, 39.82 - width / 2, 4)) { m_primitives.AddRange(base.Pad(width, new Vector3D(xx, y, 0), 0)); } width = 4.42; x = 19.08 + width / 2; y = 2.08; m_primitives.AddRange(base.Pad(width, new Vector3D(x, y, 0), 0)); width = 1.25; y = 0.68; foreach (double xx in LinSpace(14.1 + width / 2, 17.52 - width / 2, 2)) { m_primitives.AddRange(base.Pad(width, new Vector3D(xx, y, 0), 0)); } width = 1.73; y = 0.68; foreach (double xx in LinSpace(0.68 + width / 2, 5.3 - width / 2, 2)) { m_primitives.AddRange(base.Pad(width, new Vector3D(xx, y, 0), 0)); } }
public Base_1x2(Compound parent, string name, Vector3D pos, double rot) : base(parent, name, pos, rot) { Material.FillColor = new Material.Color(220, 10, 10); Material.EdgeColor = new Material.Color(220, 10, 10); CutoutMaterial = DefaultCutoutMaterial; CutoutMaterial.FillColor = new Material.Color(2, 32, 63, 123); CutoutMaterial.EdgeColor = new Material.Color(2, 32, 63, 123); LinearPolygon lp = new LinearPolygon(this, this.Material, m_priority, 2, 0, new double[,] { { 43.0, 20.0, 20.0, 0.0, 0.0, 43.0 }, { 1.78, 1.78, 0.0, 0.0, 20.0, 20.0 } }, m_thickness); m_primitives.Add(lp); lp = new LinearPolygon(this, this.Material, m_priority, 2, m_thickness, new double[,] { {43.0, 20.0, 20.0, 43.0-m_width, 43.0-m_width, 2.65, 2.65, 43.0}, {1.78, 1.78, 1.78+m_width, 1.78+m_width, 19.96-m_width, 19.96-m_width, 20.0, 20.0}}, m_heightLow); m_primitives.Add(lp); lp = new LinearPolygon(this, this.Material, m_priority, 2, m_thickness, new double[,] { { m_width, 0.0, 0.0, m_width }, { 16.2, 16.2, 20.0, 20.0 } }, m_heightHigh); m_primitives.Add(lp); lp = new LinearPolygon(this, this.Material, m_priority, 2, m_thickness, new double[,] { { 20.0, 15.24, 15.24, 20.0 }, { 0.0, 0.0, 1.12, 1.12 } }, m_heightHigh); m_primitives.Add(lp); lp = new LinearPolygon(this, this.Material, m_priority, 2, m_thickness, new double[,] { {6.65, 0.0, 0.0, m_width, m_width, 6.65}, {0.0, 0.0, 6.65, 6.65, m_width, m_width} }, m_heightHigh); m_primitives.Add(lp); // Cutout Box b = new Box(this, CutoutMaterial, m_cutoutPriority, new Vector3D(5.76, 5.70, 0), new Vector3D(18.0, 11.0, m_thickness)); m_primitives.Add(b); }