Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                Elite - VRML to JavaScript converter.
              
            
!

CSS

              
                body {
  background: #303030;
  color: white;
  font-family: arial;
  font-size: 14px;
}
              
            
!

JS

              
                
var make_hawk = `
#VRML V2.0 utf8

Shape {
	geometry IndexedFaceSet {
		color Color {
			color [
				0.125000, 0.375000, 0.375000
				0.125000, 0.375000, 0.375000
				0.375000, 0.375000, 0.375000
				0.375000, 0.375000, 0.375000
				0.125000, 0.375000, 0.375000
				0.125000, 0.375000, 0.375000
				0.125000, 0.375000, 0.375000
				0.125000, 0.375000, 0.375000
				0.125000, 0.375000, 0.375000
				0.125000, 0.375000, 0.375000
				0.125000, 0.375000, 0.875000
				0.125000, 0.375000, 0.875000
				0.375000, 0.625000, 0.625000
				0.375000, 0.625000, 0.625000
				0.375000, 0.375000, 0.375000
				0.375000, 0.375000, 0.375000
				0.375000, 0.125000, 0.375000
				0.375000, 0.125000, 0.375000
				0.125000, 0.375000, 0.625000
				0.125000, 0.375000, 0.625000
				0.375000, 0.125000, 0.625000
				0.375000, 0.125000, 0.625000
				0.875000, 0.125000, 0.125000
				0.875000, 0.125000, 0.125000
				0.125000, 0.125000, 0.375000
				0.125000, 0.125000, 0.375000
			]
		}

		coordIndex [
			0,1,2,-1,
			3,4,5,-1,
			6,7,8,-1,
			7,9,8,-1,
			10,9,4,-1,
			11,10,4,-1,
			3,11,4,-1,
			2,8,12,-1,
			12,13,2,-1,
			2,13,0,-1,
			6,2,1,-1,
			5,4,7,-1,
			1,5,7,-1,
			7,6,1,-1,
			5,1,14,-1,
			14,15,5,-1,
			14,13,12,-1,
			15,10,11,-1,
			0,13,14,-1,
			15,11,3,-1,
			1,0,14,-1,
			5,15,3,-1,
			15,14,8,-1,
			8,9,15,-1,
			12,8,14,-1,
			15,9,10,-1
		]

	coord Coordinate { point
		[
			-90,30,7,
			-30,60,97,
			-30,30,97,
			90,30,7,
			30,30,97,
			30,60,97,
			-30,30,142,
			30,30,142,
			-30,30,-142,
			30,30,-142,
			135,-60,-142,
			120,-15,-82,
			-135,-60,-142,
			-120,-15,-82,
			-30,60,-142,
			30,60,-142
		]
	}
		solid FALSE
		colorPerVertex FALSE
	}

	appearance Appearance {
		material Material {
			shininess 0.2
			specularColor 1 1 1
			diffuseColor 1.0 0.6 0.5
		}
	}
}

NavigationInfo { type "EXAMINE" }

Viewpoint {
	position 0 0 600
}`;

var make_cobra3v = `
#VRML V2.0 utf8

Shape {
	geometry IndexedFaceSet {
		color Color {
			color [
				0.625000, 0.375000, 0.125000
				0.625000, 0.375000, 0.125000
				0.375000, 0.125000, 0.125000
				0.375000, 0.125000, 0.125000
				0.125000, 0.375000, 0.125000
				0.125000, 0.375000, 0.125000
				0.125000, 0.125000, 0.375000
				0.125000, 0.125000, 0.375000
				0.625000, 0.125000, 0.125000
				0.375000, 0.375000, 0.375000
				0.375000, 0.375000, 0.375000
				0.375000, 0.375000, 0.375000
				0.125000, 0.375000, 0.375000
				0.375000, 0.375000, 0.375000
				0.875000, 0.125000, 0.125000
				0.875000, 0.125000, 0.125000
				0.875000, 0.125000, 0.125000
				0.875000, 0.125000, 0.125000
				0.875000, 0.125000, 0.125000
				0.875000, 0.125000, 0.125000
				0.125000, 0.375000, 0.125000
				0.125000, 0.375000, 0.125000
				0.125000, 0.375000, 0.375000
				0.125000, 0.375000, 0.375000
				0.125000, 0.375000, 0.375000
				0.125000, 0.375000, 0.375000
			]
		}

		coordIndex [
			0,1,2,-1,
			0,3,4,-1,
			0,5,1,-1,
			0,4,5,-1,
			2,1,6,-1,
			3,7,4,-1,
			1,8,6,-1,
			4,7,9,-1,
			2,3,0,-1,
			4,9,10,-1,
			1,11,8,-1,
			5,4,10,-1,
			5,10,11,-1,
			1,5,11,-1,
			12,13,14,-1,
			17,16,15,-1,
			20,19,18,-1,
			20,21,19,-1,
			22,23,24,-1,
			23,25,24,-1,
			2,11,10,-1,
			10,3,2,-1,
			8,11,2,-1,
			2,6,8,-1,
			3,9,7,-1,
			3,10,9,-1
		]

 	coord Coordinate {
 		point [
			0,15,10,
			80,5,-45,
			25,-5,45,
			-25,-5,45,
			-80,5,-45,
			0,15,-45,
			95,-5,-25,
			-95,-5,-25,
			95,-5,-45,
			-95,-5,-45,
			-25,-15,-45,
			25,-15,-45,
			-60,-5,-45.1,
			-60,5,-45.1,
			-75,0,-45.1,
			60,5,-45.1,
			75,0,-45.1,
			60,-5,-45.1,
			-5,5,-45.1,
			-5,-10,-45.1,
			-30,0,-45.1,
			-30,-5,-45.1,
			5,5,-45.1,
			5,-10,-45.1,
			30,0,-45.1,
			30,-5,-45.1
		]
	}
		solid FALSE
		colorPerVertex FALSE
	}

	appearance Appearance {
		material Material {
			shininess 0.2
			specularColor 1 1 1
		}
	}
}

NavigationInfo { type "EXAMINE" }

Viewpoint {
	position 0 0 512
}`;

var make_cobra3 = `
#VRML V2.0 utf8

Shape {
	geometry IndexedFaceSet {
		color Color {
			color [
				0.375000, 0.125000, 0.875000
				0.375000, 0.125000, 0.875000
				0.125000, 0.625000, 0.625000
				0.125000, 0.625000, 0.625000
				0.125000, 0.125000, 0.625000
				0.125000, 0.125000, 0.625000
				0.125000, 0.125000, 0.375000
				0.125000, 0.125000, 0.375000
				0.375000, 0.625000, 0.875000
				0.375000, 0.375000, 0.375000
				0.375000, 0.375000, 0.375000
				0.375000, 0.375000, 0.375000
				0.125000, 0.375000, 0.375000
				0.375000, 0.375000, 0.375000
				0.875000, 0.125000, 0.125000
				0.875000, 0.125000, 0.125000
				0.875000, 0.125000, 0.125000
				0.875000, 0.125000, 0.125000
				0.875000, 0.125000, 0.125000
				0.875000, 0.125000, 0.125000
				0.125000, 0.125000, 0.625000
				0.125000, 0.125000, 0.625000
				0.125000, 0.375000, 0.375000
				0.125000, 0.375000, 0.375000
				0.125000, 0.375000, 0.375000
				0.125000, 0.375000, 0.375000
			]
		}

		coordIndex [
			0,1,2,-1,
			0,3,4,-1,
			0,5,1,-1,
			0,4,5,-1,
			2,1,6,-1,
			3,7,4,-1,
			1,8,6,-1,
			4,7,9,-1,
			2,3,0,-1,
			4,9,10,-1,
			1,11,8,-1,
			5,4,10,-1,
			5,10,11,-1,
			1,5,11,-1,
			12,13,14,-1,
			17,16,15,-1,
			20,19,18,-1,
			20,21,19,-1,
			22,23,24,-1,
			23,25,24,-1,
			2,11,10,-1,
			10,3,2,-1,
			8,11,2,-1,
			2,6,8,-1,
			3,9,7,-1,
			3,10,9,-1
		]

 	coord Coordinate {
 		point [
			0,15,10,
			80,5,-45,
			25,-5,45,
			-25,-5,45,
			-80,5,-45,
			0,15,-45,
			95,-5,-25,
			-95,-5,-25,
			95,-5,-45,
			-95,-5,-45,
			-25,-15,-45,
			25,-15,-45,
			-60,-5,-45.1,
			-60,5,-45.1,
			-75,0,-45.1,
			60,5,-45.1,
			75,0,-45.1,
			60,-5,-45.1,
			-5,5,-45.1,
			-5,-10,-45.1,
			-30,0,-45.1,
			-30,-5,-45.1,
			5,5,-45.1,
			5,-10,-45.1,
			30,0,-45.1,
			30,-5,-45.1
		]
	}
		solid FALSE
		colorPerVertex FALSE
	}

	appearance Appearance {
		material Material {
			shininess 0.2
			specularColor 1 1 1
		}
	}
}

NavigationInfo { type "EXAMINE" }

Viewpoint {
	position 0 0 512
}`;

var make_constrictor = `
#VRML V2.0 utf8

Shape {
	geometry IndexedFaceSet {
		color Color {
			color [
				0.125000, 0.375000, 0.375000
				0.125000, 0.375000, 0.375000
				0.125000, 0.375000, 0.375000
				0.125000, 0.375000, 0.375000
				0.125000, 0.125000, 0.375000
				0.125000, 0.125000, 0.375000
				0.875000, 0.875000, 0.125000
				0.875000, 0.875000, 0.125000
				0.875000, 0.875000, 0.125000
				0.875000, 0.875000, 0.125000
				0.125000, 0.875000, 0.375000
				0.625000, 0.875000, 0.375000
				0.375000, 0.125000, 0.125000
				0.375000, 0.125000, 0.125000
				0.875000, 0.125000, 0.125000
				0.875000, 0.125000, 0.125000
				0.375000, 0.875000, 0.125000
				0.375000, 0.875000, 0.125000
				0.625000, 0.875000, 0.125000
				0.625000, 0.875000, 0.125000
				0.625000, 0.875000, 0.125000
				0.625000, 0.875000, 0.125000
				0.125000, 0.625000, 0.125000
				0.125000, 0.625000, 0.125000
				0.125000, 0.625000, 0.125000
				0.125000, 0.625000, 0.125000
			]
		}

		coordIndex [
			3,1,0,-1,
			3,0,2,-1,
			3,2,5,-1,
			5,2,4,-1,
			18,17,16,-1,
			21,20,19,-1,
			8,7,6,-1,
			6,9,8,-1,
			6,10,9,-1,
			10,11,9,-1,
			22,23,24,-1,
			26,25,27,-1,
			5,6,3,-1,
			5,10,6,-1,
			12,13,15,-1,
			14,12,15,-1,
			2,0,8,-1,
			8,9,2,-1,
			4,11,10,-1,
			10,5,4,-1,
			6,7,1,-1,
			1,3,6,-1,
			2,9,11,-1,
			11,4,2,-1,
			7,8,0,-1,
			0,1,7,-1
		]

	coord Coordinate {
		point [
			-20,-12,45,
			-35,-12,25,
			20,-12,45,
			-35,-12,-45,
			35,-12,25,
			35,-12,-45,
			-20,2,-45,
			-20,2,15,
			-10,2,30,
			10,2,30,
			20,2,-45,
			20,2,15,
			-15,-2,-45.1,
			-20,-7,-45.1,
			15,-2,-45.1,
			20,-7,-45.1,
			-15,-12.1,-35,
			-10,-12.1,-35,
			-10,-12.1,20,
			10,-12.1,20,
			10,-12.1,-35,
			15,-12.1,-35,
			0,2.2,25,
			-10,2.2,5,
			10,2.2,5,
			-10,2.1,-25,
			0,2.1,15,
			10,2.1,-25
		]
	}

		solid FALSE
		colorPerVertex FALSE
	}

	appearance Appearance {
		material Material {
			shininess 0.2
			specularColor 1 1 1
		}
	}
}

NavigationInfo { type "EXAMINE" }

Viewpoint {
	position 0 0 512
}`;


var make_Transporter = `
#VRML V2.0 utf8

Shape {
	geometry IndexedFaceSet {
		color Color {
			color [
				0.125000, 0.125000, 0.375000
				0.125000, 0.125000, 0.375000
				0.125000, 0.125000, 0.375000
				0.125000, 0.125000, 0.375000
				0.125000, 0.875000, 0.625000
				0.125000, 0.875000, 0.625000
				0.375000, 0.375000, 0.375000
				0.375000, 0.375000, 0.375000
				0.125000, 0.375000, 0.375000
				0.875000, 0.125000, 0.125000
				0.875000, 0.125000, 0.125000
				0.375000, 0.625000, 0.625000
				0.375000, 0.625000, 0.625000
				0.375000, 0.625000, 0.625000
				0.375000, 0.625000, 0.625000
				0.125000, 0.125000, 0.875000
				0.125000, 0.125000, 0.875000
				0.375000, 0.125000, 0.125000
				0.375000, 0.125000, 0.125000
				0.125000, 0.625000, 0.625000
				0.375000, 0.875000, 0.625000
				0.125000, 0.375000, 0.875000
				0.125000, 0.375000, 0.875000
				0.625000, 0.375000, 0.375000
				0.875000, 0.875000, 0.375000
				0.125000, 0.875000, 0.375000
				0.125000, 0.125000, 0.625000
				0.125000, 0.375000, 0.875000
				0.125000, 0.125000, 0.625000
				0.125000, 0.625000, 0.625000
				0.125000, 0.625000, 0.625000
				0.125000, 0.625000, 0.875000
				0.125000, 0.625000, 0.875000
				0.125000, 0.625000, 0.625000
				0.125000, 0.625000, 0.625000
			]
		}

		coordIndex [
			0,3,2,-1,
			0,4,5,-1,
			3,0,5,-1,
			2,1,0,-1,
			32,31,30,-1,
			35,34,33,-1,
			2,6,7,-1,
			7,1,2,-1,
			6,8,7,-1,
			37,36,14,-1,
			14,38,37,-1,
			6,2,3,-1,
			6,3,9,-1,
			10,1,7,-1,
			10,0,1,-1,
			8,11,10,-1,
			10,7,8,-1,
			21,22,23,-1,
			23,24,21,-1,
			27,26,25,-1,
			27,28,26,-1,
			11,8,6,-1,
			6,9,11,-1,
			18,19,20,-1,
			29,17,15,-1,
			16,17,29,-1,
			11,12,10,-1,
			12,11,13,-1,
			13,11,9,-1,
			9,3,5,-1,
			5,13,9,-1,
			13,5,4,-1,
			4,12,13,-1,
			4,10,12,-1,
			4,0,10,-1
		]

	coord Coordinate {
		point [
			-100,-25,60,
			-100,-25,-120,
			100,-25,-120,
			100,-25,60,
			-30,-25,120,
			30,-25,120,
			100,5,-120,
			-100,5,-120,
			0,25,-120,
			100,5,60,
			-100,5,60,
			0,25,60,
			-30,5,120,
			30,5,120,
			-50,-15,-120.1,
			30,19.1,-10,
			70,11.1,-10,
			50,15.1,20,
			30,19.1,-90,
			70,11.1,-90,
			50,15.1,-60,
			-80,9.1,-10,
			-30,19.1,-10,
			-30,19.1,4,
			-80,9.1,4,
			-70,11.1,-60,
			-50,15.1,-60,
			-50,15.1,-90,
			-30,19.1,-60,
			50,15.1,-10,
			-50,-25.1,20,
			-60,-25.1,-60,
			-40,-25.1,-60,
			50,-25.1,20,
			40,-25.1,-60,
			60,-25.1,-60,
			-50,5,-120.1,
			40,5,-120.1,
			40,-15,-120.1
		]
	}
		solid FALSE
		colorPerVertex FALSE
	}

	appearance Appearance {
		material Material {
			shininess 0.2
			specularColor 1 1 1
		}
	}
}

NavigationInfo { type "EXAMINE" }

Viewpoint {
	position 0 0 600
}`;

var make_adder = `
#VRML V2.0 utf8

Shape {
	geometry IndexedFaceSet {
		color Color {
			color [
				0.625000, 0.625000, 0.125000
				0.625000, 0.625000, 0.125000
				0.875000, 0.625000, 0.125000
				0.875000, 0.625000, 0.125000
				0.125000, 0.375000, 0.125000
				0.125000, 0.375000, 0.125000
				0.625000, 0.625000, 0.125000
				0.625000, 0.625000, 0.125000
				0.375000, 0.625000, 0.125000
				0.375000, 0.625000, 0.125000
				0.625000, 0.625000, 0.125000
				0.625000, 0.625000, 0.125000
				0.375000, 0.625000, 0.125000
				0.375000, 0.625000, 0.125000
				0.375000, 0.375000, 0.125000
				0.375000, 0.625000, 0.125000
				0.375000, 0.625000, 0.125000
				0.375000, 0.375000, 0.125000
				0.375000, 0.375000, 0.125000
				0.375000, 0.375000, 0.125000
				0.125000, 0.375000, 0.125000
				0.125000, 0.375000, 0.125000
				0.375000, 0.375000, 0.125000
				0.375000, 0.375000, 0.125000
				0.375000, 0.375000, 0.375000
				0.375000, 0.375000, 0.375000
				0.375000, 0.375000, 0.375000
				0.375000, 0.375000, 0.375000
				0.875000, 0.125000, 0.125000
				0.875000, 0.125000, 0.125000
			]
		}
		coordIndex [
			2,1,0,-1,
			2,3,1,-1,
			4,3,2,-1,
			4,2,5,-1,
			22,23,24,-1,
			27,26,25,-1,
			5,6,4,-1,
			6,5,7,-1,
			3,8,1,-1,
			4,6,9,-1,
			3,9,8,-1,
			3,4,9,-1,
			7,10,6,-1,
			10,11,6,-1,
			6,11,9,-1,
			1,12,0,-1,
			13,12,1,-1,
			8,13,1,-1,
			12,13,11,-1,
			10,12,11,-1,
			11,13,9,-1,
			13,8,9,-1,
			14,15,16,-1,
			16,17,14,-1,
			0,12,2,-1,
			2,12,10,-1,
			10,5,2,-1,
			5,10,7,-1,
			20,19,18,-1,
			20,18,21,-1
		]

	coord Coordinate { point
		[
			-80,0,-110,
			-80,0,-70,
			-60,19,-110,
			-60,19,10,
			60,19,10,
			60,19,-110,
			80,0,-70,
			80,0,-110,
			-60,0,90,
			60,0,90,
			60,-20,-110,
			60,-20,10,
			-60,-20,-110,
			-60,-20,10,
			-35,7,60,
			-35,12,40,
			35,12,40,
			35,7,60,
			-25,9,-110.1,
			25,9,-110.1,
			25,-15,-110.1,
			-25,-15,-110.1,
			13,20,-29,
			13,20,-89,
			25,20,-69,
			-13,20,-29,
			-13,20,-89,
			-25,20,-69
		]
	}
		solid FALSE
		colorPerVertex FALSE
	}

	appearance Appearance {
		material Material {
			shininess 0.2
			specularColor 1 1 1
		}
	}
}

NavigationInfo { type "EXAMINE" }

Viewpoint {
	position 0 0 600
}`;

var make_thargoid = `
#VRML V2.0 utf8

Shape {
	geometry IndexedFaceSet {
		color Color {
			color [
				0.125000, 0.125000, 0.375000
				0.125000, 0.125000, 0.375000
				0.125000, 0.125000, 0.375000
				0.125000, 0.125000, 0.375000
				0.125000, 0.125000, 0.375000
				0.125000, 0.125000, 0.375000
				0.375000, 0.125000, 0.125000
				0.375000, 0.125000, 0.125000
				0.125000, 0.125000, 0.375000
				0.125000, 0.125000, 0.375000
				0.125000, 0.125000, 0.375000
				0.125000, 0.125000, 0.375000
				0.125000, 0.125000, 0.375000
				0.125000, 0.125000, 0.375000
				0.625000, 0.125000, 0.375000
				0.625000, 0.125000, 0.375000
				0.875000, 0.125000, 0.375000
				0.875000, 0.125000, 0.375000
				0.625000, 0.125000, 0.375000
				0.625000, 0.125000, 0.375000
				0.875000, 0.125000, 0.375000
				0.875000, 0.125000, 0.375000
				0.375000, 0.125000, 0.375000
				0.375000, 0.125000, 0.375000
				0.625000, 0.125000, 0.375000
				0.625000, 0.125000, 0.375000
				0.375000, 0.125000, 0.375000
				0.375000, 0.125000, 0.375000
				0.875000, 0.125000, 0.375000
				0.875000, 0.125000, 0.375000
			]
		}

		coordIndex [
			0,1,2,-1,
			0,2,3,-1,
			0,3,4,-1,
			0,4,5,-1,
			0,5,6,-1,
			0,6,7,-1,
			16,17,18,-1,
			19,20,21,-1,
			8,9,10,-1,
			8,10,11,-1,
			8,11,12,-1,
			8,12,13,-1,
			8,13,14,-1,
			8,14,15,-1,
			1,0,11,-1,
			1,11,10,-1,
			2,1,10,-1,
			2,10,9,-1,
			3,2,9,-1,
			3,9,8,-1,
			8,15,3,-1,
			3,15,4,-1,
			4,15,14,-1,
			14,5,4,-1,
			5,14,13,-1,
			13,6,5,-1,
			6,13,12,-1,
			12,7,6,-1,
			11,0,7,-1,
			12,11,7,-1
		]

	coord Coordinate {
		point [
			-60,-9,25,
			-25,-9,60,
			25,-9,60,
			60,-9,25,
			60,-9,-25,
			25,-9,-60,
			-25,-9,-60,
			-60,-9,-25,
			36,9,14,
			16,9,36,
			-14,9,36,
			-36,9,15,
			-36,9,-15,
			-15,9,-36,
			15,9,-36,
			36,9,-15,
			-27,-9.1,-25,
			-23,-9.1,25,
			-19,-9.1,-25,
			19,-9.1,-25,
			23,-9.1,25,
			27,-9.1,-25
		]
	}
		solid FALSE
		colorPerVertex FALSE
	}

	appearance Appearance {
		material Material {
			shininess 0.2
			specularColor 1 1 1
		}
	}
}

NavigationInfo { type "EXAMINE" }

Viewpoint {
	position 0 0 600
}`;


for(var key in window) {
  if(key.indexOf("make_") > -1) {

    var polygons = getPolygons(window[key], "coordIndex");
    var points = getPoints(window[key], "point");
    var colours = getColours(window[key], "color");

    if(colours.length > 0){
      for(var i = 0; i < polygons.length; i++) {
        polygons[i][polygons[i].length-1] = colours[i];
      }
    }

    var polygonText = writePolygons(polygons);
    var pointsText = writePoints(points);

    var JavaScript = `
//#############################################################################

function ${key}() {
  var modelPoints = [
${pointsText}
  ];

  var rotatedPoints = [];
  for(var i = 0; i < modelPoints.length; i++)
    rotatedPoints.push({x: modelPoints[i].x, y: modelPoints[i].y, z: modelPoints[i].z});

  var polygons = [
${polygonText}
  ];

  return {modelPoints, rotatedPoints, polygons};
}`;
    document.write(`<pre>` + JavaScript.replace(/&/g, "&amp;").replace(/</g, "&lt;") + `</pre>`);
  }
}
//########################

function getPolygons(data, startText){
  var polygons = getGenericArrays(data, startText);
  for(var i=0; i<polygons.length; i++){
    polygons[i][polygons[i].length-1] = "gray";
    console.log(polygons[i]);
  }
  return polygons;
}

function writePolygons(polygons){
  var polygonTextLines = [];
  for(var i = 0; i < polygons.length; i++){
    var line = polygons[i];
    for(var v=0; v<line.length; v++){
      if(!isNumeric(line[v])) line[v] = line[v];
    }
    polygonTextLines.push("    [" + line.join(", ") + "]");
  }
  return polygonTextLines.join(",\n");
}

//########################

function getPoints(data, startText){
  var points = getGenericArrays(data, startText);
  return points;
}

function writePoints(points){
  var pointLines = [];
  for(var i = 0; i < points.length; i++){
    var line = points[i];
    pointLines.push(`    {x: ${line[0]}, y: ${line[1]}, z: ${line[2]}}`);
  }
  return pointLines.join(",\n");
}

//########################

function getColours(data, startText){
  var colours = getGenericArrays(data, startText);
  var colourLines = [];
  for(var i = 0; i < colours.length; i++){
    var line = colours[i];
    var r = Math.round(line[0] * 255);
    var g = Math.round(line[1] * 255);
    var b = Math.round(line[2] * 255);
    var color = `[${r}, ${g}, ${b}]`;
    colourLines.push(color);
  }
  return colourLines;
}

//########################

function isNumeric(n) {
  return !isNaN(parseFloat(n)) && isFinite(n);
}

function getGenericArrays(data, startText) {
  var genericArray = [];
  var lines = data.split("\n");
  console.log("Getting " + startText + " from lines: " + lines.length);
  var foundStart = false;
  var takingValues = false;
  for(var i=0; i<lines.length; i++){
    var lineText = lines[i];
    if(!foundStart){
      if(lineText.indexOf(startText) > -1) {
        foundStart = true;
        continue;
      }
      continue;
    }
    if(lineText.indexOf("[") > -1) continue;
    if(lineText.indexOf("]") > -1) return genericArray;
    if(lineText == "") continue;
    var line = lineText.trim();
    var line = line.replace(/,/g, " ");
    var line = line.replace(/  /g, " ");
    var line = line.trim();
    var newArray = line.split(" ");
    genericArray.push(newArray);
  }
  
  return genericArray;
}
              
            
!
999px

Console