In three.js, I have the ability to draw a spline using three coordinates - start, mid, and end. When creating this spline, the curve starts at the 'start' coordinates, rises to the 'mid' position, and then falls to the 'end' coordinates. You can view the demonstration on this jsbin.
Now, I am interested in drawing only the falling half of the spline, specifically the part from 'mid' to 'end'.
This is the original spline: https://i.sstatic.net/kpeyZ.png
My goal is to extract only the falling half of the spline and fit it into the scene, similar to the image below: https://i.sstatic.net/FZCM9.png
EDIT: Here's the code snippet:
<html>
<body>
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r75/three.js"></script>
<script>
// Global Variables
var renderer;
var scene;
var camera;
var geometry;
var control;
var count = 0;
var animationTracker;
// Initialize the scene
init();
drawSpline();
function init()
{
// Create a scene to hold all elements
scene = new THREE.Scene();
// Define the camera
camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 1000);
// Create a renderer
renderer = new THREE.WebGLRenderer();
renderer.setClearColor(0x000000, 1.0);
renderer.setSize(window.innerWidth, window.innerHeight);
// Set camera position and orientation
camera.position.set(0, 40, 40);
camera.lookAt(scene.position);
// Add renderer output to html
document.body.appendChild(renderer.domElement);
}
function drawSpline(numPoints)
{
var numPoints = 100;
var start = new THREE.Vector3(-5, 0, 20);
var middle = new THREE.Vector3(0, 35, 0);
var end = new THREE.Vector3(5, 0, -20);
var curveQuad = new THREE.QuadraticBezierCurve3(start, middle, end);
var tube = new THREE.TubeGeometry(curveQuad, numPoints, 0.5, 20, false);
var mesh = new THREE.Mesh(tube, new THREE.MeshNormalMaterial({
opacity: 0.9,
transparent: true
}));
scene.add(mesh);
renderer.render(scene, camera);
}
</script>
</body>
</html>
My intention is to adjust the falling portion of the spline to occupy the same space as the full image, as illustrated in the second image. Trimming out vertices after 'mid' would result in a very small spline section.