Initial position and direction for CylindarGeometry

Description of the problem

Currently CylinderGeometries and by extension ConeGeometries are defined in terms of their heights and radii. Would it be possible to add a feature to define the initial position for the midpoint of the geometry and a direction vector to supply and orientation?

The new signature could be:

CylinderGeometry(radiusTop, radiusBottom, height, radialSegments, heightSegments, openEnded, thetaStart, thetaLength, midpoint, orientation)
radiusTop — Radius of the cylinder at the top. Default is 1.
radiusBottom — Radius of the cylinder at the bottom. Default is 1.
height — Height of the cylinder. Default is 1.
radialSegments — Number of segmented faces around the circumference of the cylinder. Default is 8
heightSegments — Number of rows of faces along the height of the cylinder. Default is 1.
openEnded — A Boolean indicating whether the ends of the cylinder are open or capped. Default is false, meaning capped.
thetaStart — Start angle for first segment, default = 0 (three o'clock position).
thetaLength — The central angle, often called theta, of the circular sector. The default is 2*Pi, which makes for a complete cylinder. 
midpoint — The midpoint of the line connecting the top and bottom of the cylinder.
orientation — The normalized vector supplying the orientation of one end of the cylinder to point.

Thanks!

Three.js version
  • Dev
  • r90
Browser
  • All of them
  • Chrome
  • Firefox
  • Internet Explorer
OS
  • All of them
  • Windows
  • macOS
  • Linux
  • Android
  • iOS
Hardware Requirements (graphics card, VR Device, …)

Author: Fantashit

1 thought on “Initial position and direction for CylindarGeometry

  1. That is not necessary.

    var geometry = new THREE.CylinderBufferGeometry( rad, rad, height ); // or CylinderGeometry
    geometry.translate( 0, height / 2, 0 ); // optional
    geometry.rotateX( Math.PI / 2 ); // orient along z-axis - required
    geometry.lookAt( directionVector );

Comments are closed.