org.rajawali3d.curves / SVGPath

SVGPath

open class SVGPath
open class SVGPath

Parses a path from an SVG string. Please bear in mind that this is not a full XML parser. This is also an incomplete implementation. If you encounter anything that's missing please post an issue on Github and we'll add whatever you're after. What you can use is either a path String:


  String path = "M22.395-127.223c-4.492,11.344-4.688,33.75,0,44.883" +
  	"c-11.328-4.492-33.656-4.579-44.789,0.109c4.491-11.354,4.688-33.75,0-44.892" +
  	"C-11.066-122.63,11.262-122.536,22.395-127.223z";
  
  SVGPath svgPath = new SVGPath();
  List paths = svgPath.parseString(path);
  
Or you could use a string resource from the "raw" folder:

  SVGPath svgPath = new SVGPath();
  List paths = svgPath.parseResourceString(mContext, R.raw.lavatories_svg_path);
  
To draw a path:

  for(int i=0; i points = new Stack();
  	int subdiv = 1000;
  	for(int j=0; j<=subdiv; j++)
  	{
  		points.add(subPath.calculatePoint(j / subdiv));
  	}
  	pathPoints.add(points);
  	Line3D line = new Line3D(points, 1);
  	SimpleMaterial material = new SimpleMaterial();
  	material.setUseSingleColor(true);
  	line.setMaterial(material);
 	getCurrentScene().addChild(line);
  }
  

Author
dennis.ippel