Browse Source

Merge pull request #14418 from yomboprime/dev

Add transform SVG node parse
Mr.doob 7 years ago
parent
commit
92fff338ab

+ 321 - 24
examples/js/loaders/SVGLoader.js

@@ -1,6 +1,7 @@
 /**
  * @author mrdoob / http://mrdoob.com/
  * @author zz85 / http://joshuakoo.com/
+ * @author yomboprime / https://yombo.org
  */
 
 THREE.SVGLoader = function ( manager ) {
@@ -32,6 +33,10 @@ THREE.SVGLoader.prototype = {
 
 			if ( node.nodeType !== 1 ) return;
 
+			var transform = getNodeTransform( node );
+
+			var path = null;
+
 			switch ( node.nodeName ) {
 
 				case 'svg':
@@ -43,37 +48,37 @@ THREE.SVGLoader.prototype = {
 
 				case 'path':
 					style = parseStyle( node, style );
-					if ( node.hasAttribute( 'd' ) && isVisible( style ) ) paths.push( parsePathNode( node, style ) );
+					if ( node.hasAttribute( 'd' ) && isVisible( style ) ) path = parsePathNode( node, style );
 					break;
 
 				case 'rect':
 					style = parseStyle( node, style );
-					if ( isVisible( style ) ) paths.push( parseRectNode( node, style ) );
+					if ( isVisible( style ) ) path = parseRectNode( node, style );
 					break;
 
 				case 'polygon':
 					style = parseStyle( node, style );
-					if ( isVisible( style ) ) paths.push( parsePolygonNode( node, style ) );
+					if ( isVisible( style ) ) path = parsePolygonNode( node, style );
 					break;
 
 				case 'polyline':
 					style = parseStyle( node, style );
-					if ( isVisible( style ) ) paths.push( parsePolylineNode( node, style ) );
+					if ( isVisible( style ) ) path = parsePolylineNode( node, style );
 					break;
 
 				case 'circle':
 					style = parseStyle( node, style );
-					if ( isVisible( style ) ) paths.push( parseCircleNode( node, style ) );
+					if ( isVisible( style ) ) path = parseCircleNode( node, style );
 					break;
 
 				case 'ellipse':
 					style = parseStyle( node, style );
-					if ( isVisible( style ) ) paths.push( parseEllipseNode( node, style ) );
+					if ( isVisible( style ) ) path = parseEllipseNode( node, style );
 					break;
 
 				case 'line':
 					style = parseStyle( node, style );
-					if ( isVisible( style ) ) paths.push( parseLineNode( node, style ) );
+					if ( isVisible( style ) ) path = parseLineNode( node, style );
 					break;
 
 				default:
@@ -81,6 +86,14 @@ THREE.SVGLoader.prototype = {
 
 			}
 
+			if ( path ) {
+
+				transformPath( path, currentTransform );
+
+				paths.push( path );
+
+			}
+
 			var nodes = node.childNodes;
 
 			for ( var i = 0; i < nodes.length; i ++ ) {
@@ -89,6 +102,12 @@ THREE.SVGLoader.prototype = {
 
 			}
 
+			if ( transform ) {
+
+				currentTransform.copy( transformStack.pop() );
+
+			}
+
 		}
 
 		function parsePathNode( node, style ) {
@@ -99,6 +118,10 @@ THREE.SVGLoader.prototype = {
 			var point = new THREE.Vector2();
 			var control = new THREE.Vector2();
 
+			var firstPoint = new THREE.Vector2();
+			var isFirstPoint = true;
+			var doSetFirstPoint = false;
+
 			var d = node.getAttribute( 'd' );
 
 			// console.log( d );
@@ -112,6 +135,11 @@ THREE.SVGLoader.prototype = {
 				var type = command.charAt( 0 );
 				var data = command.substr( 1 ).trim();
 
+				if ( isFirstPoint ) {
+					doSetFirstPoint = true;
+				}
+				isFirstPoint = false;
+
 				switch ( type ) {
 
 					case 'M':
@@ -121,7 +149,12 @@ THREE.SVGLoader.prototype = {
 							point.y = numbers[ j + 1 ];
 							control.x = point.x;
 							control.y = point.y;
-							path.moveTo( point.x, point.y );
+							if ( j === 0 ) {
+								path.moveTo( point.x, point.y );
+							}
+							else {
+								path.lineTo( point.x, point.y );
+							}
 						}
 						break;
 
@@ -249,7 +282,12 @@ THREE.SVGLoader.prototype = {
 							point.y += numbers[ j + 1 ];
 							control.x = point.x;
 							control.y = point.y;
-							path.moveTo( point.x, point.y );
+							if ( j === 0 ) {
+								path.moveTo( point.x, point.y );
+							}
+							else {
+								path.lineTo( point.x, point.y );
+							}
 						}
 						break;
 
@@ -375,21 +413,9 @@ THREE.SVGLoader.prototype = {
 						path.currentPath.autoClose = true;
 						if ( path.currentPath.curves.length > 0 ) {
 							// Reset point to beginning of Path
-							var curve = path.currentPath.curves[ 0 ];
-							if ( curve.isLineCurve ) {
-								point.x = curve.v1.x;
-								point.y = curve.v1.y;
-							} else if ( curve.isEllipseCurve || curve.isArcCurve ) {
-								point.x = curve.aX;
-								point.y = curve.aY;
-							} else if ( curve.isCubicBezierCurve || curve.isQuadraticBezierCurve ) {
-								point.x = curve.v0.x;
-								point.y = curve.v0.y;
-							} else if ( curve.isSplineCurve ) {
-								point.x = curve.points[ 0 ].x;
-								point.y = curve.points[ 0 ].y;
-							}
+							point.copy( firstPoint );
 							path.currentPath.currentPoint.copy( point );
+							isFirstPoint = true;
 						}
 						break;
 
@@ -400,6 +426,13 @@ THREE.SVGLoader.prototype = {
 
 				// console.log( type, parseFloats( data ), parseFloats( data ).length  )
 
+				if ( doSetFirstPoint ) {
+
+					firstPoint.copy( point );
+
+					doSetFirstPoint = false;
+
+				}
 			}
 
 			return path;
@@ -503,7 +536,13 @@ THREE.SVGLoader.prototype = {
 			if ( rx !== 0 || ry !== 0 ) {
 
 				path.bezierCurveTo( x, y + h, x, y + h, x, y + h - 2 * ry );
-				path.lineTo( x, y + 2 * ry );
+
+			}
+
+			path.lineTo( x, y + 2 * ry );
+
+			if ( rx !== 0 || ry !== 0 ) {
+
 				path.bezierCurveTo( x, y, x, y, x + 2 * rx, y );
 
 			}
@@ -683,6 +722,255 @@ THREE.SVGLoader.prototype = {
 
 			return array;
 
+
+		}
+
+		function getNodeTransform( node ) {
+
+			if ( ! node.hasAttribute( 'transform' ) ) {
+				return null;
+			}
+
+			var transform = parseTransformNode( node );
+
+			if ( transform ) {
+
+				if ( transformStack.length > 0 ) {
+					transform.premultiply( transformStack[ transformStack.length - 1 ] );
+				}
+
+				currentTransform.copy( transform );
+				transformStack.push( transform );
+
+			}
+
+			return transform;
+	
+		}
+
+		function parseTransformNode( node ) {
+
+			var transformAttr = node.getAttribute( 'transform' );
+			var transform = null;
+			var openParPos = transformAttr.indexOf( "(" );
+			var closeParPos = transformAttr.indexOf( ")" );
+
+			if ( openParPos > 0 && openParPos < closeParPos ) {
+
+				var transformType = transformAttr.substr( 0, openParPos );
+				
+				var array = parseFloats( transformAttr.substr( openParPos + 1, closeParPos - openParPos - 1 ) );
+
+				switch ( transformType ) {
+					
+					case "translate":
+
+						if ( array.length >= 1 ) {
+
+							transform = new THREE.Matrix3();
+
+							var tx = array[ 0 ];
+							var ty = tx;
+
+							if ( array.length >= 2 ) {
+
+								ty = array[ 1 ];
+
+							}
+
+							transform.translate( tx, ty );
+
+						}
+
+						break;
+
+					case "rotate":
+
+						if ( array.length >= 1 ) {
+
+							var angle = 0;
+							var cx = 0;
+							var cy = 0;
+
+							transform = new THREE.Matrix3();
+
+							// Angle
+							angle = - array[ 0 ] * Math.PI / 180;
+
+							if ( array.length >= 3 ) {
+
+								// Center x, y
+								cx = array[ 1 ];
+								cy = array[ 2 ];
+
+							}
+
+							// Rotate around center (cx, cy)
+							tempTransform1.identity().translate( -cx, -cy );
+							tempTransform2.identity().rotate( angle );
+							tempTransform3.multiplyMatrices( tempTransform2, tempTransform1 );
+							tempTransform1.identity().translate( cx, cy );
+							transform.multiplyMatrices( tempTransform1, tempTransform3 );
+
+						}
+
+						break;
+
+					case "scale":
+
+						if ( array.length >= 1 ) {
+
+							transform = new THREE.Matrix3();
+
+							var scaleX = array[ 0 ];
+							var scaleY = scaleX;
+
+							if ( array.length >= 2 ) {
+								scaleY = array[ 1 ];
+							}
+
+							transform.scale( scaleX, scaleY );
+
+						}
+
+						break;
+
+					case "skewX":
+
+						if ( array.length === 1 ) {
+
+							transform = new THREE.Matrix3();
+
+							transform.set(
+								1, Math.tan( array[ 0 ] * Math.PI / 180 ), 0,
+								0, 1, 0,
+								0, 0, 1
+							);							
+
+						}
+
+						break;
+
+					case "skewY":
+
+						if ( array.length === 1 ) {
+
+							transform = new THREE.Matrix3();
+
+							transform.set(
+								1, 0, 0,
+								Math.tan( array[ 0 ] * Math.PI / 180 ), 1, 0,
+								0, 0, 1
+							);
+
+						}
+
+						break;
+
+					case "matrix":
+
+						if ( array.length === 6 ) {
+
+							transform = new THREE.Matrix3();
+
+							transform.set(
+								array[ 0 ], array[ 2 ], array[ 4 ],
+								array[ 1 ], array[ 3 ], array[ 5 ],
+								0, 0, 1
+							);
+
+						}
+
+						break;
+				}
+
+			}
+			
+			return transform;
+
+		}
+
+		function transformPath( path, m ) {
+
+			function transfVec2( v2 ) {
+
+				tempV3.set( v2.x, v2.y, 1 ).applyMatrix3( m );
+
+				v2.set( tempV3.x, tempV3.y );
+
+			}
+
+			var isRotated = isTransformRotated( m );
+
+			var tempV2 = new THREE.Vector2();
+			var tempV3 = new THREE.Vector3();
+
+			var subPaths = path.subPaths;
+
+			for ( var i = 0, n = subPaths.length; i < n; i++ ) {
+
+				var subPath = subPaths[ i ];
+				var curves = subPath.curves;
+
+				for ( var j = 0; j < curves.length; j++ ) {
+
+					var curve = curves[ j ];
+
+					if ( curve.isLineCurve ) {
+
+						transfVec2( curve.v1 );
+						transfVec2( curve.v2 );
+
+					}
+					else if ( curve.isCubicBezierCurve ) {
+
+						transfVec2( curve.v0 );
+						transfVec2( curve.v1 );
+						transfVec2( curve.v2 );
+						transfVec2( curve.v3 );
+
+					}
+					else if ( curve.isQuadraticBezierCurve ) {
+
+						transfVec2( curve.v0 );
+						transfVec2( curve.v1 );
+						transfVec2( curve.v2 );
+
+					}
+					else if ( curve.isEllipseCurve ) {
+
+						if ( isRotated ) {
+							console.warn( "SVGLoader: Elliptic arc or ellipse rotation or skewing is not implemented." );
+						}
+
+						tempV2.set( curve.aX, curve.aY );
+						transfVec2( tempV2 );
+						curve.aX = tempV2.x;
+						curve.aY = tempV2.y;
+
+						curve.xRadius *= getTransformScaleX( m );
+						curve.yRadius *= getTransformScaleY( m );
+
+					}
+
+				}
+	
+			}
+
+		}
+
+		function isTransformRotated( m ) {
+			return m.elements[ 1 ] !== 0 || m.elements[ 3 ] !== 0;
+		}
+
+		function getTransformScaleX( m ) {
+			var te = m.elements;
+			return Math.sqrt( te[ 0 ] * te[ 0 ] + te[ 1 ] * te[ 1 ] )
+		}
+
+		function getTransformScaleY( m ) {
+			var te = m.elements;
+			return Math.sqrt( te[ 3 ] * te[ 3 ] + te[ 4 ] * te[ 4 ] )
 		}
 
 		//
@@ -691,6 +979,14 @@ THREE.SVGLoader.prototype = {
 
 		var paths = [];
 
+		var transformStack = [];
+
+		var tempTransform1 = new THREE.Matrix3();
+		var tempTransform2 = new THREE.Matrix3();
+		var tempTransform3 = new THREE.Matrix3();
+
+		var currentTransform = new THREE.Matrix3();
+
 		console.time( 'THREE.SVGLoader: DOMParser' );
 
 		var xml = new DOMParser().parseFromString( text, 'image/svg+xml' ); // application/xml
@@ -703,6 +999,7 @@ THREE.SVGLoader.prototype = {
 
 		// console.log( paths );
 
+
 		console.timeEnd( 'THREE.SVGLoader: Parse' );
 
 		return paths;

BIN
examples/models/svg/tests/1.png


+ 96 - 0
examples/models/svg/tests/1.svg

@@ -0,0 +1,96 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   width="210mm"
+   height="297mm"
+   viewBox="0 0 210 297"
+   version="1.1"
+   id="svg8"
+   inkscape:version="0.92.2 (5c3e80d, 2017-08-06)"
+   sodipodi:docname="1.svg"
+   inkscape:export-filename=""
+   inkscape:export-xdpi="149.98094"
+   inkscape:export-ydpi="149.98094">
+  <defs
+     id="defs2" />
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     inkscape:pageopacity="0.0"
+     inkscape:pageshadow="2"
+     inkscape:zoom="0.49497475"
+     inkscape:cx="-345.56008"
+     inkscape:cy="768.64217"
+     inkscape:document-units="mm"
+     inkscape:current-layer="layer1"
+     showgrid="false"
+     inkscape:window-width="1920"
+     inkscape:window-height="1015"
+     inkscape:window-x="0"
+     inkscape:window-y="0"
+     inkscape:window-maximized="1" />
+  <metadata
+     id="metadata5">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <dc:title />
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <g
+     inkscape:label="Capa 1"
+     inkscape:groupmode="layer"
+     id="layer1">
+    <g
+       aria-label="Three.js"
+       style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:22.57777786px;line-height:1.25;font-family:Ubuntu;-inkscape-font-specification:Ubuntu;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
+       id="text817">
+      <path
+         d="m 39.122152,29.585705 v 1.896534 H 34.200196 V 45.232105 H 32.010152 V 31.482239 h -4.921956 v -1.896534 z"
+         style="stroke-width:0.26458332"
+         id="path814" />
+      <path
+         d="M 41.277272,45.232105 V 28.072994 l 2.099733,-0.361244 v 6.005689 q 0.587022,-0.225778 1.241778,-0.338667 0.677333,-0.135467 1.332089,-0.135467 1.399822,0 2.325511,0.4064 0.925689,0.383822 1.467555,1.106311 0.564445,0.699911 0.790222,1.693334 0.225778,0.993422 0.225778,2.190044 v 6.592711 H 48.660205 V 39.09095 q 0,-1.083734 -0.158045,-1.851378 -0.135466,-0.767645 -0.474133,-1.241778 -0.338667,-0.474133 -0.903111,-0.677333 -0.564444,-0.225778 -1.399822,-0.225778 -0.338667,0 -0.699911,0.04516 -0.361245,0.04516 -0.699911,0.112888 -0.316089,0.04516 -0.587023,0.112889 -0.248355,0.06773 -0.361244,0.112889 v 9.7536 z"
+         style="stroke-width:0.26458332"
+         id="path816" />
+      <path
+         d="m 58.488594,33.243305 q 0.270934,0 0.6096,0.04516 0.361245,0.02258 0.699912,0.09031 0.338666,0.04516 0.6096,0.112889 0.293511,0.04516 0.428977,0.09031 l -0.361244,1.8288 q -0.248356,-0.09031 -0.835378,-0.2032 -0.564444,-0.135467 -1.467555,-0.135467 -0.587023,0 -1.174045,0.135467 -0.564444,0.112889 -0.745067,0.158044 v 9.866489 H 54.153661 V 33.988372 q 0.745067,-0.270933 1.851378,-0.496711 1.106311,-0.248356 2.483555,-0.248356 z"
+         style="stroke-width:0.26458332"
+         id="path818" />
+      <path
+         d="m 62.230156,39.384461 q 0,-1.557867 0.451556,-2.709334 0.451555,-1.174044 1.196622,-1.941688 0.745067,-0.767645 1.715911,-1.151467 0.970845,-0.383822 1.986845,-0.383822 2.370666,0 3.635022,1.490133 1.264355,1.467556 1.264355,4.492978 0,0.135466 0,0.361244 0,0.2032 -0.02258,0.383822 h -8.037689 q 0.135466,1.8288 1.061155,2.777067 0.925689,0.948267 2.889956,0.948267 1.106311,0 1.851378,-0.180622 0.767644,-0.2032 1.151466,-0.383823 l 0.293511,1.761067 q -0.383822,0.2032 -1.354666,0.428978 -0.948267,0.225778 -2.167467,0.225778 -1.535289,0 -2.664178,-0.451556 -1.106311,-0.474133 -1.8288,-1.286933 -0.722489,-0.8128 -1.083733,-1.919111 -0.338667,-1.128889 -0.338667,-2.460978 z m 8.060267,-1.151467 q 0.02258,-1.4224 -0.722489,-2.325511 -0.722489,-0.925689 -2.009422,-0.925689 -0.722489,0 -1.286934,0.293511 -0.541866,0.270934 -0.925688,0.722489 -0.383823,0.451556 -0.6096,1.038578 -0.2032,0.587022 -0.270934,1.196622 z"
+         style="stroke-width:0.26458332"
+         id="path820" />
+      <path
+         d="m 74.841961,39.384461 q 0,-1.557867 0.451556,-2.709334 0.451555,-1.174044 1.196622,-1.941688 0.745067,-0.767645 1.715911,-1.151467 0.970845,-0.383822 1.986845,-0.383822 2.370666,0 3.635022,1.490133 1.264355,1.467556 1.264355,4.492978 0,0.135466 0,0.361244 0,0.2032 -0.02258,0.383822 h -8.037689 q 0.135466,1.8288 1.061155,2.777067 0.925689,0.948267 2.889956,0.948267 1.106311,0 1.851378,-0.180622 0.767644,-0.2032 1.151466,-0.383823 l 0.293511,1.761067 q -0.383822,0.2032 -1.354666,0.428978 -0.948267,0.225778 -2.167467,0.225778 -1.535289,0 -2.664178,-0.451556 -1.106311,-0.474133 -1.8288,-1.286933 -0.722489,-0.8128 -1.083733,-1.919111 -0.338667,-1.128889 -0.338667,-2.460978 z m 8.060267,-1.151467 q 0.02258,-1.4224 -0.722489,-2.325511 -0.722489,-0.925689 -2.009422,-0.925689 -0.722489,0 -1.286934,0.293511 -0.541866,0.270934 -0.925688,0.722489 -0.383823,0.451556 -0.6096,1.038578 -0.2032,0.587022 -0.270934,1.196622 z"
+         style="stroke-width:0.26458332"
+         id="path822" />
+      <path
+         d="m 90.592077,44.012905 q 0,0.6096 -0.4064,1.061156 -0.4064,0.451555 -1.106311,0.451555 -0.699911,0 -1.106311,-0.451555 -0.4064,-0.451556 -0.4064,-1.061156 0,-0.6096 0.4064,-1.061155 0.4064,-0.451556 1.106311,-0.451556 0.699911,0 1.106311,0.451556 0.4064,0.451555 0.4064,1.061155 z"
+         style="stroke-width:0.26458332"
+         id="path824" />
+      <path
+         d="m 91.745662,49.45415 q -0.270933,0 -0.699911,-0.06773 -0.428978,-0.06773 -0.722489,-0.180622 l 0.270933,-1.715911 q 0.225778,0.06773 0.519289,0.112889 0.293511,0.04516 0.541867,0.04516 1.083733,0 1.535289,-0.677333 0.474133,-0.654755 0.474133,-1.941689 V 33.491661 h 2.099734 v 11.514666 q 0,2.257778 -1.038578,3.341512 -1.016,1.106311 -2.980267,1.106311 z m 2.957689,-18.0848 q -0.564444,0 -0.970844,-0.361245 -0.383823,-0.383822 -0.383823,-1.016 0,-0.632178 0.383823,-0.993422 0.4064,-0.383822 0.970844,-0.383822 0.564444,0 0.948267,0.383822 0.4064,0.361244 0.4064,0.993422 0,0.632178 -0.4064,1.016 -0.383823,0.361245 -0.948267,0.361245 z"
+         style="stroke-width:0.26458332"
+         id="path826" />
+      <path
+         d="m 102.12932,43.719394 q 1.28693,0 1.89653,-0.338667 0.63218,-0.338666 0.63218,-1.083733 0,-0.767644 -0.6096,-1.2192 -0.6096,-0.451555 -2.00942,-1.016 -0.67733,-0.270933 -1.30951,-0.541867 -0.6096,-0.293511 -1.061158,-0.677333 -0.451555,-0.383822 -0.722489,-0.925689 -0.270933,-0.541866 -0.270933,-1.332089 0,-1.557866 1.151467,-2.460977 1.151463,-0.925689 3.138313,-0.925689 0.49671,0 0.99342,0.06773 0.49671,0.04516 0.92569,0.135467 0.42898,0.06773 0.74507,0.158044 0.33866,0.09031 0.51928,0.158045 l -0.38382,1.806222 q -0.33866,-0.180622 -1.06115,-0.361245 -0.72249,-0.2032 -1.73849,-0.2032 -0.88054,0 -1.53529,0.361245 -0.65476,0.338666 -0.65476,1.083733 0,0.383822 0.13547,0.677333 0.15804,0.293512 0.45156,0.541867 0.31608,0.225778 0.76764,0.428978 0.45156,0.2032 1.08373,0.428978 0.83538,0.316089 1.49014,0.632177 0.65475,0.293512 1.10631,0.699912 0.47413,0.4064 0.72249,0.993422 0.24835,0.564444 0.24835,1.399822 0,1.6256 -1.2192,2.460978 -1.19662,0.835378 -3.43182,0.835378 -1.55787,0 -2.4384,-0.270934 -0.880533,-0.248355 -1.196622,-0.383822 l 0.383822,-1.806222 q 0.361244,0.135466 1.15147,0.4064 0.79022,0.270933 2.09973,0.270933 z"
+         style="stroke-width:0.26458332"
+         id="path828" />
+    </g>
+  </g>
+</svg>

BIN
examples/models/svg/tests/2.png


+ 105 - 0
examples/models/svg/tests/2.svg

@@ -0,0 +1,105 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   width="210mm"
+   height="297mm"
+   viewBox="0 0 210 297"
+   version="1.1"
+   id="svg8"
+   inkscape:version="0.92.2 (5c3e80d, 2017-08-06)"
+   sodipodi:docname="2.svg"
+   inkscape:export-filename=""
+   inkscape:export-xdpi="149.98094"
+   inkscape:export-ydpi="149.98094">
+  <defs
+     id="defs2" />
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     inkscape:pageopacity="0.0"
+     inkscape:pageshadow="2"
+     inkscape:zoom="0.49497475"
+     inkscape:cx="180.72939"
+     inkscape:cy="809.04827"
+     inkscape:document-units="mm"
+     inkscape:current-layer="layer1"
+     showgrid="false"
+     inkscape:window-width="1920"
+     inkscape:window-height="1015"
+     inkscape:window-x="0"
+     inkscape:window-y="0"
+     inkscape:window-maximized="1" />
+  <metadata
+     id="metadata5">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <dc:title></dc:title>
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <g
+     inkscape:label="Capa 1"
+     inkscape:groupmode="layer"
+     id="layer1">
+    <g
+       aria-label="Three.js"
+       style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:22.57777786px;line-height:1.25;font-family:Ubuntu;-inkscape-font-specification:Ubuntu;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
+       id="text817"
+       transform="rotate(-30,66.934268,38.58295)">
+      <path
+         d="m 39.122152,29.585705 v 1.896534 H 34.200196 V 45.232105 H 32.010152 V 31.482239 h -4.921956 v -1.896534 z"
+         style="stroke-width:0.26458332"
+         id="path814"
+         inkscape:connector-curvature="0" />
+      <path
+         d="M 41.277272,45.232105 V 28.072994 l 2.099733,-0.361244 v 6.005689 q 0.587022,-0.225778 1.241778,-0.338667 0.677333,-0.135467 1.332089,-0.135467 1.399822,0 2.325511,0.4064 0.925689,0.383822 1.467555,1.106311 0.564445,0.699911 0.790222,1.693334 0.225778,0.993422 0.225778,2.190044 v 6.592711 H 48.660205 V 39.09095 q 0,-1.083734 -0.158045,-1.851378 -0.135466,-0.767645 -0.474133,-1.241778 -0.338667,-0.474133 -0.903111,-0.677333 -0.564444,-0.225778 -1.399822,-0.225778 -0.338667,0 -0.699911,0.04516 -0.361245,0.04516 -0.699911,0.112888 -0.316089,0.04516 -0.587023,0.112889 -0.248355,0.06773 -0.361244,0.112889 v 9.7536 z"
+         style="stroke-width:0.26458332"
+         id="path816"
+         inkscape:connector-curvature="0" />
+      <path
+         d="m 58.488594,33.243305 q 0.270934,0 0.6096,0.04516 0.361245,0.02258 0.699912,0.09031 0.338666,0.04516 0.6096,0.112889 0.293511,0.04516 0.428977,0.09031 l -0.361244,1.8288 q -0.248356,-0.09031 -0.835378,-0.2032 -0.564444,-0.135467 -1.467555,-0.135467 -0.587023,0 -1.174045,0.135467 -0.564444,0.112889 -0.745067,0.158044 v 9.866489 H 54.153661 V 33.988372 q 0.745067,-0.270933 1.851378,-0.496711 1.106311,-0.248356 2.483555,-0.248356 z"
+         style="stroke-width:0.26458332"
+         id="path818"
+         inkscape:connector-curvature="0" />
+      <path
+         d="m 62.230156,39.384461 q 0,-1.557867 0.451556,-2.709334 0.451555,-1.174044 1.196622,-1.941688 0.745067,-0.767645 1.715911,-1.151467 0.970845,-0.383822 1.986845,-0.383822 2.370666,0 3.635022,1.490133 1.264355,1.467556 1.264355,4.492978 0,0.135466 0,0.361244 0,0.2032 -0.02258,0.383822 h -8.037689 q 0.135466,1.8288 1.061155,2.777067 0.925689,0.948267 2.889956,0.948267 1.106311,0 1.851378,-0.180622 0.767644,-0.2032 1.151466,-0.383823 l 0.293511,1.761067 q -0.383822,0.2032 -1.354666,0.428978 -0.948267,0.225778 -2.167467,0.225778 -1.535289,0 -2.664178,-0.451556 -1.106311,-0.474133 -1.8288,-1.286933 -0.722489,-0.8128 -1.083733,-1.919111 -0.338667,-1.128889 -0.338667,-2.460978 z m 8.060267,-1.151467 q 0.02258,-1.4224 -0.722489,-2.325511 -0.722489,-0.925689 -2.009422,-0.925689 -0.722489,0 -1.286934,0.293511 -0.541866,0.270934 -0.925688,0.722489 -0.383823,0.451556 -0.6096,1.038578 -0.2032,0.587022 -0.270934,1.196622 z"
+         style="stroke-width:0.26458332"
+         id="path820"
+         inkscape:connector-curvature="0" />
+      <path
+         d="m 74.841961,39.384461 q 0,-1.557867 0.451556,-2.709334 0.451555,-1.174044 1.196622,-1.941688 0.745067,-0.767645 1.715911,-1.151467 0.970845,-0.383822 1.986845,-0.383822 2.370666,0 3.635022,1.490133 1.264355,1.467556 1.264355,4.492978 0,0.135466 0,0.361244 0,0.2032 -0.02258,0.383822 h -8.037689 q 0.135466,1.8288 1.061155,2.777067 0.925689,0.948267 2.889956,0.948267 1.106311,0 1.851378,-0.180622 0.767644,-0.2032 1.151466,-0.383823 l 0.293511,1.761067 q -0.383822,0.2032 -1.354666,0.428978 -0.948267,0.225778 -2.167467,0.225778 -1.535289,0 -2.664178,-0.451556 -1.106311,-0.474133 -1.8288,-1.286933 -0.722489,-0.8128 -1.083733,-1.919111 -0.338667,-1.128889 -0.338667,-2.460978 z m 8.060267,-1.151467 q 0.02258,-1.4224 -0.722489,-2.325511 -0.722489,-0.925689 -2.009422,-0.925689 -0.722489,0 -1.286934,0.293511 -0.541866,0.270934 -0.925688,0.722489 -0.383823,0.451556 -0.6096,1.038578 -0.2032,0.587022 -0.270934,1.196622 z"
+         style="stroke-width:0.26458332"
+         id="path822"
+         inkscape:connector-curvature="0" />
+      <path
+         d="m 90.592077,44.012905 q 0,0.6096 -0.4064,1.061156 -0.4064,0.451555 -1.106311,0.451555 -0.699911,0 -1.106311,-0.451555 -0.4064,-0.451556 -0.4064,-1.061156 0,-0.6096 0.4064,-1.061155 0.4064,-0.451556 1.106311,-0.451556 0.699911,0 1.106311,0.451556 0.4064,0.451555 0.4064,1.061155 z"
+         style="stroke-width:0.26458332"
+         id="path824"
+         inkscape:connector-curvature="0" />
+      <path
+         d="m 91.745662,49.45415 q -0.270933,0 -0.699911,-0.06773 -0.428978,-0.06773 -0.722489,-0.180622 l 0.270933,-1.715911 q 0.225778,0.06773 0.519289,0.112889 0.293511,0.04516 0.541867,0.04516 1.083733,0 1.535289,-0.677333 0.474133,-0.654755 0.474133,-1.941689 V 33.491661 h 2.099734 v 11.514666 q 0,2.257778 -1.038578,3.341512 -1.016,1.106311 -2.980267,1.106311 z m 2.957689,-18.0848 q -0.564444,0 -0.970844,-0.361245 -0.383823,-0.383822 -0.383823,-1.016 0,-0.632178 0.383823,-0.993422 0.4064,-0.383822 0.970844,-0.383822 0.564444,0 0.948267,0.383822 0.4064,0.361244 0.4064,0.993422 0,0.632178 -0.4064,1.016 -0.383823,0.361245 -0.948267,0.361245 z"
+         style="stroke-width:0.26458332"
+         id="path826"
+         inkscape:connector-curvature="0" />
+      <path
+         d="m 102.12932,43.719394 q 1.28693,0 1.89653,-0.338667 0.63218,-0.338666 0.63218,-1.083733 0,-0.767644 -0.6096,-1.2192 -0.6096,-0.451555 -2.00942,-1.016 -0.67733,-0.270933 -1.30951,-0.541867 -0.6096,-0.293511 -1.061158,-0.677333 -0.451555,-0.383822 -0.722489,-0.925689 -0.270933,-0.541866 -0.270933,-1.332089 0,-1.557866 1.151467,-2.460977 1.151463,-0.925689 3.138313,-0.925689 0.49671,0 0.99342,0.06773 0.49671,0.04516 0.92569,0.135467 0.42898,0.06773 0.74507,0.158044 0.33866,0.09031 0.51928,0.158045 l -0.38382,1.806222 q -0.33866,-0.180622 -1.06115,-0.361245 -0.72249,-0.2032 -1.73849,-0.2032 -0.88054,0 -1.53529,0.361245 -0.65476,0.338666 -0.65476,1.083733 0,0.383822 0.13547,0.677333 0.15804,0.293512 0.45156,0.541867 0.31608,0.225778 0.76764,0.428978 0.45156,0.2032 1.08373,0.428978 0.83538,0.316089 1.49014,0.632177 0.65475,0.293512 1.10631,0.699912 0.47413,0.4064 0.72249,0.993422 0.24835,0.564444 0.24835,1.399822 0,1.6256 -1.2192,2.460978 -1.19662,0.835378 -3.43182,0.835378 -1.55787,0 -2.4384,-0.270934 -0.880533,-0.248355 -1.196622,-0.383822 l 0.383822,-1.806222 q 0.361244,0.135466 1.15147,0.4064 0.79022,0.270933 2.09973,0.270933 z"
+         style="stroke-width:0.26458332"
+         id="path828"
+         inkscape:connector-curvature="0" />
+    </g>
+  </g>
+</svg>

BIN
examples/models/svg/tests/3.png


+ 105 - 0
examples/models/svg/tests/3.svg

@@ -0,0 +1,105 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   width="210mm"
+   height="297mm"
+   viewBox="0 0 210 297"
+   version="1.1"
+   id="svg8"
+   inkscape:version="0.92.2 (5c3e80d, 2017-08-06)"
+   sodipodi:docname="3.svg"
+   inkscape:export-filename=""
+   inkscape:export-xdpi="149.98094"
+   inkscape:export-ydpi="149.98094">
+  <defs
+     id="defs2" />
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     inkscape:pageopacity="0.0"
+     inkscape:pageshadow="2"
+     inkscape:zoom="0.49497475"
+     inkscape:cx="180.72939"
+     inkscape:cy="809.04827"
+     inkscape:document-units="mm"
+     inkscape:current-layer="layer1"
+     showgrid="false"
+     inkscape:window-width="1920"
+     inkscape:window-height="1015"
+     inkscape:window-x="0"
+     inkscape:window-y="0"
+     inkscape:window-maximized="1" />
+  <metadata
+     id="metadata5">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <dc:title></dc:title>
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <g
+     inkscape:label="Capa 1"
+     inkscape:groupmode="layer"
+     id="layer1">
+    <g
+       aria-label="Three.js"
+       style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:22.57777786px;line-height:1.25;font-family:Ubuntu;-inkscape-font-specification:Ubuntu;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
+       id="text817"
+       transform="matrix(1.7884384,-0.78408147,1.0325554,1.3580689,-51.066515,52.200548)">
+      <path
+         d="m 39.122152,29.585705 v 1.896534 H 34.200196 V 45.232105 H 32.010152 V 31.482239 h -4.921956 v -1.896534 z"
+         style="stroke-width:0.26458332"
+         id="path814"
+         inkscape:connector-curvature="0" />
+      <path
+         d="M 41.277272,45.232105 V 28.072994 l 2.099733,-0.361244 v 6.005689 q 0.587022,-0.225778 1.241778,-0.338667 0.677333,-0.135467 1.332089,-0.135467 1.399822,0 2.325511,0.4064 0.925689,0.383822 1.467555,1.106311 0.564445,0.699911 0.790222,1.693334 0.225778,0.993422 0.225778,2.190044 v 6.592711 H 48.660205 V 39.09095 q 0,-1.083734 -0.158045,-1.851378 -0.135466,-0.767645 -0.474133,-1.241778 -0.338667,-0.474133 -0.903111,-0.677333 -0.564444,-0.225778 -1.399822,-0.225778 -0.338667,0 -0.699911,0.04516 -0.361245,0.04516 -0.699911,0.112888 -0.316089,0.04516 -0.587023,0.112889 -0.248355,0.06773 -0.361244,0.112889 v 9.7536 z"
+         style="stroke-width:0.26458332"
+         id="path816"
+         inkscape:connector-curvature="0" />
+      <path
+         d="m 58.488594,33.243305 q 0.270934,0 0.6096,0.04516 0.361245,0.02258 0.699912,0.09031 0.338666,0.04516 0.6096,0.112889 0.293511,0.04516 0.428977,0.09031 l -0.361244,1.8288 q -0.248356,-0.09031 -0.835378,-0.2032 -0.564444,-0.135467 -1.467555,-0.135467 -0.587023,0 -1.174045,0.135467 -0.564444,0.112889 -0.745067,0.158044 v 9.866489 H 54.153661 V 33.988372 q 0.745067,-0.270933 1.851378,-0.496711 1.106311,-0.248356 2.483555,-0.248356 z"
+         style="stroke-width:0.26458332"
+         id="path818"
+         inkscape:connector-curvature="0" />
+      <path
+         d="m 62.230156,39.384461 q 0,-1.557867 0.451556,-2.709334 0.451555,-1.174044 1.196622,-1.941688 0.745067,-0.767645 1.715911,-1.151467 0.970845,-0.383822 1.986845,-0.383822 2.370666,0 3.635022,1.490133 1.264355,1.467556 1.264355,4.492978 0,0.135466 0,0.361244 0,0.2032 -0.02258,0.383822 h -8.037689 q 0.135466,1.8288 1.061155,2.777067 0.925689,0.948267 2.889956,0.948267 1.106311,0 1.851378,-0.180622 0.767644,-0.2032 1.151466,-0.383823 l 0.293511,1.761067 q -0.383822,0.2032 -1.354666,0.428978 -0.948267,0.225778 -2.167467,0.225778 -1.535289,0 -2.664178,-0.451556 -1.106311,-0.474133 -1.8288,-1.286933 -0.722489,-0.8128 -1.083733,-1.919111 -0.338667,-1.128889 -0.338667,-2.460978 z m 8.060267,-1.151467 q 0.02258,-1.4224 -0.722489,-2.325511 -0.722489,-0.925689 -2.009422,-0.925689 -0.722489,0 -1.286934,0.293511 -0.541866,0.270934 -0.925688,0.722489 -0.383823,0.451556 -0.6096,1.038578 -0.2032,0.587022 -0.270934,1.196622 z"
+         style="stroke-width:0.26458332"
+         id="path820"
+         inkscape:connector-curvature="0" />
+      <path
+         d="m 74.841961,39.384461 q 0,-1.557867 0.451556,-2.709334 0.451555,-1.174044 1.196622,-1.941688 0.745067,-0.767645 1.715911,-1.151467 0.970845,-0.383822 1.986845,-0.383822 2.370666,0 3.635022,1.490133 1.264355,1.467556 1.264355,4.492978 0,0.135466 0,0.361244 0,0.2032 -0.02258,0.383822 h -8.037689 q 0.135466,1.8288 1.061155,2.777067 0.925689,0.948267 2.889956,0.948267 1.106311,0 1.851378,-0.180622 0.767644,-0.2032 1.151466,-0.383823 l 0.293511,1.761067 q -0.383822,0.2032 -1.354666,0.428978 -0.948267,0.225778 -2.167467,0.225778 -1.535289,0 -2.664178,-0.451556 -1.106311,-0.474133 -1.8288,-1.286933 -0.722489,-0.8128 -1.083733,-1.919111 -0.338667,-1.128889 -0.338667,-2.460978 z m 8.060267,-1.151467 q 0.02258,-1.4224 -0.722489,-2.325511 -0.722489,-0.925689 -2.009422,-0.925689 -0.722489,0 -1.286934,0.293511 -0.541866,0.270934 -0.925688,0.722489 -0.383823,0.451556 -0.6096,1.038578 -0.2032,0.587022 -0.270934,1.196622 z"
+         style="stroke-width:0.26458332"
+         id="path822"
+         inkscape:connector-curvature="0" />
+      <path
+         d="m 90.592077,44.012905 q 0,0.6096 -0.4064,1.061156 -0.4064,0.451555 -1.106311,0.451555 -0.699911,0 -1.106311,-0.451555 -0.4064,-0.451556 -0.4064,-1.061156 0,-0.6096 0.4064,-1.061155 0.4064,-0.451556 1.106311,-0.451556 0.699911,0 1.106311,0.451556 0.4064,0.451555 0.4064,1.061155 z"
+         style="stroke-width:0.26458332"
+         id="path824"
+         inkscape:connector-curvature="0" />
+      <path
+         d="m 91.745662,49.45415 q -0.270933,0 -0.699911,-0.06773 -0.428978,-0.06773 -0.722489,-0.180622 l 0.270933,-1.715911 q 0.225778,0.06773 0.519289,0.112889 0.293511,0.04516 0.541867,0.04516 1.083733,0 1.535289,-0.677333 0.474133,-0.654755 0.474133,-1.941689 V 33.491661 h 2.099734 v 11.514666 q 0,2.257778 -1.038578,3.341512 -1.016,1.106311 -2.980267,1.106311 z m 2.957689,-18.0848 q -0.564444,0 -0.970844,-0.361245 -0.383823,-0.383822 -0.383823,-1.016 0,-0.632178 0.383823,-0.993422 0.4064,-0.383822 0.970844,-0.383822 0.564444,0 0.948267,0.383822 0.4064,0.361244 0.4064,0.993422 0,0.632178 -0.4064,1.016 -0.383823,0.361245 -0.948267,0.361245 z"
+         style="stroke-width:0.26458332"
+         id="path826"
+         inkscape:connector-curvature="0" />
+      <path
+         d="m 102.12932,43.719394 q 1.28693,0 1.89653,-0.338667 0.63218,-0.338666 0.63218,-1.083733 0,-0.767644 -0.6096,-1.2192 -0.6096,-0.451555 -2.00942,-1.016 -0.67733,-0.270933 -1.30951,-0.541867 -0.6096,-0.293511 -1.061158,-0.677333 -0.451555,-0.383822 -0.722489,-0.925689 -0.270933,-0.541866 -0.270933,-1.332089 0,-1.557866 1.151467,-2.460977 1.151463,-0.925689 3.138313,-0.925689 0.49671,0 0.99342,0.06773 0.49671,0.04516 0.92569,0.135467 0.42898,0.06773 0.74507,0.158044 0.33866,0.09031 0.51928,0.158045 l -0.38382,1.806222 q -0.33866,-0.180622 -1.06115,-0.361245 -0.72249,-0.2032 -1.73849,-0.2032 -0.88054,0 -1.53529,0.361245 -0.65476,0.338666 -0.65476,1.083733 0,0.383822 0.13547,0.677333 0.15804,0.293512 0.45156,0.541867 0.31608,0.225778 0.76764,0.428978 0.45156,0.2032 1.08373,0.428978 0.83538,0.316089 1.49014,0.632177 0.65475,0.293512 1.10631,0.699912 0.47413,0.4064 0.72249,0.993422 0.24835,0.564444 0.24835,1.399822 0,1.6256 -1.2192,2.460978 -1.19662,0.835378 -3.43182,0.835378 -1.55787,0 -2.4384,-0.270934 -0.880533,-0.248355 -1.196622,-0.383822 l 0.383822,-1.806222 q 0.361244,0.135466 1.15147,0.4064 0.79022,0.270933 2.09973,0.270933 z"
+         style="stroke-width:0.26458332"
+         id="path828"
+         inkscape:connector-curvature="0" />
+    </g>
+  </g>
+</svg>

BIN
examples/models/svg/tests/4.png


+ 66 - 0
examples/models/svg/tests/4.svg

@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   width="210mm"
+   height="297mm"
+   viewBox="0 0 210 297"
+   version="1.1"
+   id="svg8"
+   inkscape:version="0.92.2 (5c3e80d, 2017-08-06)"
+   sodipodi:docname="4.svg"
+   inkscape:export-filename=""
+   inkscape:export-xdpi="149.98094"
+   inkscape:export-ydpi="149.98094">
+  <defs
+     id="defs2" />
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     inkscape:pageopacity="0.0"
+     inkscape:pageshadow="2"
+     inkscape:zoom="0.49497475"
+     inkscape:cx="-224.34178"
+     inkscape:cy="809.04827"
+     inkscape:document-units="mm"
+     inkscape:current-layer="layer1"
+     showgrid="false"
+     inkscape:window-width="1920"
+     inkscape:window-height="1015"
+     inkscape:window-x="0"
+     inkscape:window-y="0"
+     inkscape:window-maximized="1" />
+  <metadata
+     id="metadata5">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <dc:title></dc:title>
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <g
+     inkscape:label="Capa 1"
+     inkscape:groupmode="layer"
+     id="layer1">
+    <rect
+       style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.44999999;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       id="rect821"
+       width="107.97688"
+       height="59.868374"
+       x="18.708866"
+       y="19.039692" />
+  </g>
+</svg>

BIN
examples/models/svg/tests/5.png


+ 68 - 0
examples/models/svg/tests/5.svg

@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   width="210mm"
+   height="297mm"
+   viewBox="0 0 210 297"
+   version="1.1"
+   id="svg8"
+   inkscape:version="0.92.2 (5c3e80d, 2017-08-06)"
+   sodipodi:docname="5.svg"
+   inkscape:export-filename=""
+   inkscape:export-xdpi="149.98094"
+   inkscape:export-ydpi="149.98094">
+  <defs
+     id="defs2" />
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     inkscape:pageopacity="0.0"
+     inkscape:pageshadow="2"
+     inkscape:zoom="0.49497475"
+     inkscape:cx="378.71929"
+     inkscape:cy="609.03807"
+     inkscape:document-units="mm"
+     inkscape:current-layer="layer1"
+     showgrid="false"
+     inkscape:window-width="1920"
+     inkscape:window-height="1015"
+     inkscape:window-x="0"
+     inkscape:window-y="0"
+     inkscape:window-maximized="1" />
+  <metadata
+     id="metadata5">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <dc:title />
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <g
+     inkscape:label="Capa 1"
+     inkscape:groupmode="layer"
+     id="layer1">
+    <rect
+       style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.44999999;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       id="rect821"
+       width="107.97688"
+       height="59.868374"
+       x="18.708866"
+       y="19.039692"
+       rx="10"
+       ry="10" />
+  </g>
+</svg>

BIN
examples/models/svg/tests/6.png


+ 69 - 0
examples/models/svg/tests/6.svg

@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   width="210mm"
+   height="297mm"
+   viewBox="0 0 210 297"
+   version="1.1"
+   id="svg8"
+   inkscape:version="0.92.2 (5c3e80d, 2017-08-06)"
+   sodipodi:docname="6.svg"
+   inkscape:export-filename=""
+   inkscape:export-xdpi="149.98094"
+   inkscape:export-ydpi="149.98094">
+  <defs
+     id="defs2" />
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     inkscape:pageopacity="0.0"
+     inkscape:pageshadow="2"
+     inkscape:zoom="0.49497475"
+     inkscape:cx="-26.351878"
+     inkscape:cy="609.03807"
+     inkscape:document-units="mm"
+     inkscape:current-layer="layer1"
+     showgrid="false"
+     inkscape:window-width="1920"
+     inkscape:window-height="1015"
+     inkscape:window-x="0"
+     inkscape:window-y="0"
+     inkscape:window-maximized="1" />
+  <metadata
+     id="metadata5">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <dc:title />
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <g
+     inkscape:label="Capa 1"
+     inkscape:groupmode="layer"
+     id="layer1">
+    <rect
+       style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.44999999;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       id="rect821"
+       width="107.97688"
+       height="59.868374"
+       x="-69.666222"
+       y="76.970978"
+       rx="10"
+       ry="10"
+       transform="rotate(-48)" />
+  </g>
+</svg>

BIN
examples/models/svg/tests/7.png


+ 66 - 0
examples/models/svg/tests/7.svg

@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   width="210mm"
+   height="297mm"
+   viewBox="0 0 210 297"
+   version="1.1"
+   id="svg8"
+   inkscape:version="0.92.2 (5c3e80d, 2017-08-06)"
+   sodipodi:docname="7.svg"
+   inkscape:export-filename=""
+   inkscape:export-xdpi="149.98094"
+   inkscape:export-ydpi="149.98094">
+  <defs
+     id="defs2" />
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     inkscape:pageopacity="0.0"
+     inkscape:pageshadow="2"
+     inkscape:zoom="0.49497475"
+     inkscape:cx="258.51114"
+     inkscape:cy="677.72844"
+     inkscape:document-units="mm"
+     inkscape:current-layer="layer1"
+     showgrid="false"
+     inkscape:window-width="1920"
+     inkscape:window-height="1015"
+     inkscape:window-x="0"
+     inkscape:window-y="0"
+     inkscape:window-maximized="1" />
+  <metadata
+     id="metadata5">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <dc:title />
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <g
+     inkscape:label="Capa 1"
+     inkscape:groupmode="layer"
+     id="layer1"
+     transform="scale(1.7,1.1)">
+    <circle
+       style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.44999999;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       id="path816"
+       cx="71.8955"
+       cy="52.715652"
+       r="27.564367" />
+  </g>
+</svg>