internal override bool ParseNodeBodyElement(string id, VRMLParser parser) { if (id == "controlPoint") { ControlPoint.AddRange(parser.ParseSFVec2fOrMFVec2fValue()); } else if (id == "tessellation") { Tessellation = parser.ParseIntValue(); } else if (id == "weight") { Weight.AddRange(parser.ParseSFFloatOrMFFloatValue()); } else if (id == "closed") { Closed = parser.ParseBoolValue(); } else if (id == "knot") { Knot.AddRange(parser.ParseSFFloatOrMFFloatValue()); } else if (id == "order") { Order = parser.ParseIntValue(); } else { return(false); } return(true); }
internal override bool ParseNodeBodyElement(string id, VRMLParser parser) { int line = parser.Line; if (id == "controlPoint") { X3DNode node = parser.ParseSFNodeValue(); if (node != null) { ControlPoint = node as X3DCoordinateNode; if (ControlPoint == null) { parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line); } } } else if (id == "knot") { Knot.AddRange(parser.ParseSFFloatOrMFFloatValue()); } else if (id == "order") { Order = parser.ParseIntValue(); } else if (id == "weight" || id == "keyWeight") { Weight.AddRange(parser.ParseSFFloatOrMFFloatValue()); } else if (id == "dimension") { Dimension = parser.ParseIntValue(); } else if (id == "fractionAbsolute") { FractionAbsolute = parser.ParseBoolValue(); } else if (id == "keyValue") { List <SFVec3f> controlPoints = parser.ParseSFVec3fOrMFVec3fValue(); if (ControlPoint == null) { ControlPoint = new x3dCoordinate(); } x3dCoordinate cp = ControlPoint as x3dCoordinate; if (cp != null) { cp.Point.AddRange(controlPoints); } } else { return(false); } return(true); }
internal override bool ParseNodeBodyElement(string id, VRMLParser parser) { int line = parser.Line; if (id == "controlPoint") { X3DNode node = parser.ParseSFNodeValue(); if (node != null) { ControlPoint = node as X3DCoordinateNode; if (ControlPoint == null) { parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line); } } } else if (id == "weight") { Weight.AddRange(parser.ParseSFFloatOrMFFloatValue()); } else if (id == "uDimension") { UDimension = parser.ParseIntValue(); } else if (id == "uKnot") { UKnot.AddRange(parser.ParseSFFloatOrMFFloatValue()); } else if (id == "uOrder") { UOrder = parser.ParseIntValue(); } else if (id == "vDimension") { VDimension = parser.ParseIntValue(); } else if (id == "vKnot") { VKnot.AddRange(parser.ParseSFFloatOrMFFloatValue()); } else if (id == "vOrder") { VOrder = parser.ParseIntValue(); } else { return(false); } return(true); }
internal override bool ParseNodeBodyElement(string id, VRMLParser parser) { if (id == "controlPoint") { ControlPoint.AddRange(parser.ParseSFVec2fOrMFVec2fValue()); } else if (id == "weight") { Weight.AddRange(parser.ParseSFFloatOrMFFloatValue()); } else if (id == "uDimension") { UDimension = parser.ParseIntValue(); } else if (id == "uKnot") { UKnot.AddRange(parser.ParseSFFloatOrMFFloatValue()); } else if (id == "uOrder") { UOrder = parser.ParseIntValue(); } else if (id == "vDimension") { VDimension = parser.ParseIntValue(); } else if (id == "vKnot") { VKnot.AddRange(parser.ParseSFFloatOrMFFloatValue()); } else if (id == "vOrder") { VOrder = parser.ParseIntValue(); } else { return(false); } return(true); }
private void Load() { #region TreningData Model.Series.Add(new LineSeries() { Title = "Trening", MarkerSize = 11, MarkerType = MarkerType.Circle, LineStyle = LineStyle.None, MarkerFill = OxyColors.Red, ItemsSource = Controled }); #endregion var axisx = new LinearAxis() { Minimum = ax.X, Maximum = ax.Y, PositionAtZeroCrossing = true, AxislineStyle = LineStyle.Solid, }; var axisy = new LinearAxis() { Minimum = ay.X, Maximum = ay.Y, PositionAtZeroCrossing = true, AxislineStyle = LineStyle.Solid, Position = AxisPosition.Top }; Model.Axes.Add(axisx); Model.Axes.Add(axisy); #region TestingData List <DataPoint> Tested = new List <DataPoint>(); foreach (var item in TestingData) { Tested.Add(new DataPoint(item.X, item.Y)); } Model.Series.Add(new LineSeries() { Title = "Tested", MarkerSize = 11, MarkerType = MarkerType.Square, LineStyle = LineStyle.None, MarkerFill = OxyColors.Blue, ItemsSource = Tested }); #endregion LineSeries Pos = new LineSeries() { Title = "1", MarkerSize = 8, MarkerType = MarkerType.Triangle, LineStyle = LineStyle.None, MarkerFill = OxyColors.GreenYellow, ItemsSource = Positive }; LineSeries Neg = new LineSeries() { Title = "0", MarkerSize = 8, MarkerType = MarkerType.Diamond, LineStyle = LineStyle.None, MarkerFill = OxyColors.BlueViolet, ItemsSource = Negative }; Model.Series.Add(Pos); Model.Series.Add(Neg); Model.Series.Add(new LineSeries()); model.InvalidatePlot(true); Perceptron.Generate(TreningData, w); UpdateLine(); Weight.Clear(); Weight.AddRange(Perceptron.GetWeight()); UpdateLine(); }
internal override bool ParseNodeBodyElement(string id, VRMLParser parser) { int line = parser.Line; if (id == "children") { List <X3DNode> nodes = parser.ParseSFNodeOrMFNodeValue(); foreach (X3DNode node in nodes) { X3DChildNode child = node as X3DShapeNode; if (child == null) { parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line); } else { Children.Add(child); } } } else if (id == "controlPoint") { object token = parser.PeekNextToken(); if (token is VRMLTokenIdKeywordOrFieldType) { X3DNode node = parser.ParseSFNodeValue(); if (node != null) { ControlPoint = node as X3DCoordinateNode; if (ControlPoint == null) { parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line); } } } else { x3dCoordinate coords = new x3dCoordinate(); coords.Point = parser.ParseSFVec3fOrMFVec3fValue(); ControlPoint = coords; } } else if (id == "inputCoord") { List <X3DNode> nodes = parser.ParseSFNodeOrMFNodeValue(); foreach (X3DNode node in nodes) { X3DCoordinateNode coord = node as X3DCoordinateNode; if (coord == null) { parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line); } else { InputCoord.Add(coord); } } } else if (id == "inputTransform") { List <X3DNode> nodes = parser.ParseSFNodeOrMFNodeValue(); foreach (X3DNode node in nodes) { IX3DCoordinateDeformerInputTransform transf = node as IX3DCoordinateDeformerInputTransform; if (transf == null) { parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line); } else { InputTransform.Add(transf); } } } else if (id == "outputCoord") { List <X3DNode> nodes = parser.ParseSFNodeOrMFNodeValue(); foreach (X3DNode node in nodes) { X3DCoordinateNode coord = node as X3DCoordinateNode; if (coord == null) { parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line); } else { OutputCoord.Add(coord); } } } else if (id == "weight") { Weight.AddRange(parser.ParseSFFloatOrMFFloatValue()); } else if (id == "bboxCenter") { BBoxCenter = parser.ParseSFVec3fValue(); } else if (id == "bboxSize") { BBoxSize = parser.ParseSFVec3fValue(); } else if (id == "uDimension") { UDimension = parser.ParseIntValue(); } else if (id == "uKnot") { UKnot.AddRange(parser.ParseSFFloatOrMFFloatValue()); } else if (id == "uOrder") { UOrder = parser.ParseIntValue(); } else if (id == "vDimension") { VDimension = parser.ParseIntValue(); } else if (id == "vKnot") { VKnot.AddRange(parser.ParseSFFloatOrMFFloatValue()); } else if (id == "vOrder") { VOrder = parser.ParseIntValue(); } else if (id == "wDimension") { WDimension = parser.ParseIntValue(); } else if (id == "wKnot") { WKnot.AddRange(parser.ParseSFFloatOrMFFloatValue()); } else if (id == "wOrder") { WOrder = parser.ParseIntValue(); } else { return(false); } return(true); }
internal override bool ParseNodeBodyElement(string id, VRMLParser parser) { int line = parser.Line; if (id == "controlPoint") { X3DNode node = parser.ParseSFNodeValue(); if (node != null) { ControlPoint = node as X3DCoordinateNode; if (ControlPoint == null) { parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line); } } } else if (id == "texCoord") { X3DNode node = parser.ParseSFNodeValue(); if (node != null) { TexCoord = node as IX3DNurbsSurfaceGeometryNodeTexCoord; if (TexCoord == null) { parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line); } } } else if (id == "trimmingContour") { List <X3DNode> nodes = parser.ParseSFNodeOrMFNodeValue(); foreach (X3DNode node in nodes) { IX3DContour2DNode contour = node as IX3DContour2DNode; if (contour == null) { parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line); } else { TrimmingContour.Add(contour); } } } else if (id == "uTessellation") { UTessellation = parser.ParseIntValue(); } else if (id == "vTessellation") { VTessellation = parser.ParseIntValue(); } else if (id == "weight") { Weight.AddRange(parser.ParseSFFloatOrMFFloatValue()); } else if (id == "solid") { Solid = parser.ParseBoolValue(); } else if (id == "uClosed") { UClosed = parser.ParseBoolValue(); } else if (id == "uDimension") { UDimension = parser.ParseIntValue(); } else if (id == "uKnot") { UKnot.AddRange(parser.ParseSFFloatOrMFFloatValue()); } else if (id == "uOrder") { UOrder = parser.ParseIntValue(); } else if (id == "vClosed") { VClosed = parser.ParseBoolValue(); } else if (id == "vDimension") { VDimension = parser.ParseIntValue(); } else if (id == "vKnot") { VKnot.AddRange(parser.ParseSFFloatOrMFFloatValue()); } else if (id == "vOrder") { VOrder = parser.ParseIntValue(); } else { return(false); } return(true); }
internal override bool ParseNodeBodyElement(string id, VRMLParser parser) { int line = parser.Line; if (id == "controlPoint") { object token = parser.PeekNextToken(); if (token is VRMLTokenIdKeywordOrFieldType) { X3DNode node = parser.ParseSFNodeValue(); if (node != null) { ControlPoint = node as X3DCoordinateNode; if (ControlPoint == null) { parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line); } } } else { x3dCoordinate coords = new x3dCoordinate(); coords.Point = parser.ParseSFVec3fOrMFVec3fValue(); ControlPoint = coords; } } else if (id == "texCoord") { X3DNode node = parser.ParseSFNodeValue(); if (node != null) { TexCoord = node as IX3DNurbsSurfaceGeometryNodeTexCoord; if (TexCoord == null) { parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line); } } } else if (id == "uTessellation") { UTessellation = parser.ParseIntValue(); } else if (id == "vTessellation") { VTessellation = parser.ParseIntValue(); } else if (id == "weight") { Weight.AddRange(parser.ParseSFFloatOrMFFloatValue()); } else if (id == "ccw") { CCW = parser.ParseBoolValue(); } else if (id == "solid") { Solid = parser.ParseBoolValue(); } else if (id == "uClosed") { UClosed = parser.ParseBoolValue(); } else if (id == "uDimension") { UDimension = parser.ParseIntValue(); } else if (id == "uKnot") { UKnot.AddRange(parser.ParseSFFloatOrMFFloatValue()); } else if (id == "uOrder") { UOrder = parser.ParseIntValue(); } else if (id == "vClosed") { VClosed = parser.ParseBoolValue(); } else if (id == "vDimension") { VDimension = parser.ParseIntValue(); } else if (id == "vKnot") { VKnot.AddRange(parser.ParseSFFloatOrMFFloatValue()); } else if (id == "vOrder") { VOrder = parser.ParseIntValue(); } else { return(false); } return(true); }