public bool EnviarDatosPoligono([FromBody] Poligonos pol) { //Console.WriteLine(poly); //Console.WriteLine(nombre); //Console.WriteLine(idUsuario); int aux = pol.IdAdmin; //int aux2 = pol.IdPoligonos; string aux3 = pol.Nombre; string aux4 = pol.Coordenadas; return(context.Guardarpoligono(aux, aux4, aux3)); }
private void CalcularButton_Click(object sender, EventArgs e) { if (!Validar()) { return; } Poligonos poligonos = new Poligonos ( lados: Convert.ToSingle(LadosTextBox.Text), apotema2: Convert.ToSingle(ApotematextBox.Text) ); ResultadotextBox.AppendText(Convert.ToString(poligonos.TOString()) + "\t"); Limpiar(); }
// TODO: analizar el uso de las capas de trabajo y cálculo y reprogramar el proceso, tener en cuenta que se pueden producir capas sin trazos, teneer en cuenta el bbox.z del poligono private IList <StrokeSLT> _GenerateShell(Poligonos Pols, double AnchoBoquilla, double Grosor) { IList <StrokeSLT> Res = new List <StrokeSLT>(); //borde exterior i=0 no se calcula como shell //bordes para formar el shell i<= int.Parse((Grosor/AnchoBoquilla).ToString()) for (int i = 1; i *AnchoBoquilla < Grosor; i++) { //genero la equidistancia del polígono Poligonos PolsEq = Pols.Equidista(i * AnchoBoquilla); //Obtengo la ruta del polígono IList <StrokeSLT> ResEq = PolsEq.TrazarPerimetro(Modes.ModoFill); foreach (StrokeSLT t in ResEq) { Res.Add(t); } } return(Res); }
private IList <StrokeSLT> _GenerateFill(Poligonos Pols, double AnchoBoquilla, double Porcentaje, double AnguloTrama) { IList <StrokeSLT> Res = new List <StrokeSLT>(); if (Porcentaje > 1.0) { Porcentaje = 1.0; } if (Porcentaje < 0.0) { Porcentaje = 0.0; } double PasoTrama = Porcentaje * AnchoBoquilla; // /1 if (PasoTrama > 0.0) //omite PasoTrama inferior o igual a 0 { //con el AnguloTrama y el PasoTrama intersectar con los poligonos //recorre el bounding box de los polígonos Punto Centro = Pols.Bownding.Centro; double SemiDiagonal = Pols.Bownding.Diagonal * 1.1 / 2.0;//con un 10% de margen double DeltaX = Convert.ToSingle(Math.Sin(Convert.ToDouble(AnguloTrama))) * SemiDiagonal; double DeltaY = Convert.ToSingle(Math.Sin((Math.PI / 2) - Convert.ToDouble(AnguloTrama))) * SemiDiagonal; //oriento el rayo Segmento Rayo = new Segmento(new Punto(Centro.X - DeltaX, Centro.Y - DeltaY, Centro.Z), new Punto(Centro.X + DeltaX, Centro.Y + DeltaY, Centro.Z)); //desplazo al inicio Rayo = Rayo.Equidista(-SemiDiagonal); IList <Segmento> ResSegmentos = new List <Segmento>(); bool InvierteTrazo = false; int Pasos = Convert.ToInt32(SemiDiagonal * 2.0 / PasoTrama); while (Pasos > 0) { IList <Segmento> TempSegmentos = Pols.SegmentosInteriores(Rayo); if (InvierteTrazo) { for (int i = TempSegmentos.Count - 1; i >= 0; i--) { StrokeSLT TT = new StrokeSLT(); //trazo de traslación TT.Mode = Modes.ModeTraslation; TT.Pendiente = true; TT.Destino = new VertexSLT(TempSegmentos[i].Final.X, TempSegmentos[i].Final.Y, TempSegmentos[i].Final.Z); Res.Add(TT); //trazo de relleno TT.Mode = Modes.ModoFill; TT.Pendiente = true; TT.Destino = new VertexSLT(TempSegmentos[i].Inicio.X, TempSegmentos[i].Inicio.Y, TempSegmentos[i].Inicio.Z); //trazo de traslación Res.Add(TT); } } else { for (int i = 0; i < TempSegmentos.Count; i++) { StrokeSLT TT = new StrokeSLT(); //trazo de traslación TT.Mode = Modes.ModeTraslation; TT.Pendiente = true; TT.Destino = new VertexSLT(TempSegmentos[i].Inicio.X, TempSegmentos[i].Inicio.Y, TempSegmentos[i].Inicio.Z); Res.Add(TT); //trazo de relleno TT.Mode = Modes.ModoFill; TT.Pendiente = true; TT.Destino = new VertexSLT(TempSegmentos[i].Final.X, TempSegmentos[i].Final.Y, TempSegmentos[i].Final.Z); //trazo de traslación Res.Add(TT); } } //a la próxima la dirección es la contraria InvierteTrazo = !InvierteTrazo; //desplaza PasoTrama el rayo y lo recalcula Rayo = Rayo.Equidista(PasoTrama); //evalua si se ha salido del bounding box Pasos--; } } return(Res); }
internal void GenerateLayer() { //_GeneratingLayer = true; if (ZCalculo <= Solido.Top) { LayerCalculo = new List <StrokeSLT>(); IList <LineSLT> Corte = new List <LineSLT>(); //obtiene cada uno de los segmentos y puntos aislados de la sección Solido.CortePlanoZ(ZCalculo, out Corte); //obtiene los polígonos e islas Poligonos TempPols = new Poligonos(Corte); IList <StrokeSLT> ResEq = TempPols.TrazarPerimetro(Modes.ModoRim); /*if (ResEq.Count == 0) * { * Stroke stroke = new Stroke * { * Destino = new VertexSLT(0.0, 0.0, _ZCalculo), * E = 0.0, * Mode = Modes.ModeTraslation, * Pendiente = true * }; * * _LayerCalculo.Add(stroke); * * stroke.Destino = new VertexSLT(10.0, 10.0, _ZCalculo); * * _LayerCalculo.Add(stroke); * } * else * {*/ foreach (StrokeSLT t in ResEq) { LayerCalculo.Add(t); } //} //Shell en modo relleno /*IList<Trazo> TempShell = _GeneraShell(TempPols, _AperturaBoquilla, _GrosorShell); * foreach (Trazo t in TempShell) * { * _LayerCalculo.Add(t); * }*/ //Relleno /*IList<Trazo> TempRelleno = _GeneraRelleno(TempPols, _AperturaBoquilla, _PorcentajeRelleno, _AnguloLayer); * foreach (Trazo t in TempRelleno) * { * _LayerCalculo.Add(t); * }*/ //soportes //TODO //Layer terminada _AnguloLayer += Math.PI / 6.0; ZTrazado = ZCalculo; ZCalculo += DeltaLayer; //_GeneratingLayer = false; } else { LayerCalculo = null; } }
public void Add(Poligono p) { Poligonos.Add(p); }
public Objeto(Poligono p) { this.Poligonos = new List <Poligono>(); Poligonos.Add(p); relatividad = Relatividad.escenario; }