Skip to content

Commit

Permalink
Merge pull request #299 from WhitestormJS/#297
Browse files Browse the repository at this point in the history
Adding Tube, Torus, Torusknot, Terahedron type definitions - #297
  • Loading branch information
sasha240100 committed Jul 17, 2017
2 parents 1202cb9 + d9a7c74 commit 0d70c54
Show file tree
Hide file tree
Showing 5 changed files with 222 additions and 2 deletions.
38 changes: 38 additions & 0 deletions types/components/meshes/Tetrahedron.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import {MeshComponent, MeshComponentParams} from '../../core/MeshComponent';
import {
Mesh
} from 'three';

interface TetrahedronParams extends MeshComponentParams {

/** Parameters */
parameters?: {

/**
* Radius of the tetrahedron.
* Default is 1.
*/
radius?: number;

/**
* Setting this to a value greater than 0 adds vertices making it no longer a tetrahedron.
* Default is 0.
*/
detail?: number;

}
}

export class Tetrahedron extends MeshComponent {
/**
* @constructor Creates Tetrahedron
* @param params
*/
constructor(params?: TetrahedronParams);

/**
* Build lifecycle creates a mesh using input params.
* @param params
*/
build(params?: TetrahedronParams): Mesh;
}
56 changes: 56 additions & 0 deletions types/components/meshes/Torus.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import {MeshComponent, MeshComponentParams} from '../../core/MeshComponent';
import {
Mesh
} from 'three';

interface TorusParams extends MeshComponentParams {

/** Parameters */
parameters?: {

/**
* Radius.
* Default is 100.
*/
radius?: number;

/**
* Diameter of the tube.
* Default is 40.
*/
tube?: number;

/**
* The number of segments going along the tube.
* Default is 6.
*/
tubularSegments?: number;

/**
* The number of segments going along the radius.
* Default 8
*/
radialSegments?: number;

/**
* Central angle..
* Default is Math.PI * 2.
*/
arc?: number;

}
}

export class Torus extends MeshComponent {
/**
* @constructor Creates Torus
* @param params
*/
constructor(params?: TorusParams);

/**
* Build lifecycle creates a mesh using input params.
* @param params
*/
build(params?: TorusParams): Mesh;
}
62 changes: 62 additions & 0 deletions types/components/meshes/Torusknot.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import {MeshComponent, MeshComponentParams} from '../../core/MeshComponent';
import {
Mesh
} from 'three';

interface TorusknotParams extends MeshComponentParams {

/** Parameters */
parameters?: {

/**
* Radius.
* Default is 100.
*/
radius?: number;

/**
* Diameter of the tube.
* Default is 40.
*/
tube?: number;

/**
* The number of segments going along the tube.
* Default is 8.
*/
tubularSegments?: number;

/**
* The number of segments going along the radius.
* Default 64
*/
radialSegments?: number;

/**
* This value determines, how many times the geometry winds around its axis of rotational symmetry.
* Default is 2.
*/
p?: number;

/**
* This value determines, how many times the geometry winds around a circle in the interior of the torus.
* Default is 3.
*/
q?: number;

}
}

export class Torusknot extends MeshComponent {
/**
* @constructor Creates Torusknot
* @param params
*/
constructor(params?: TorusknotParams);

/**
* Build lifecycle creates a mesh using input params.
* @param params
*/
build(params?: TorusknotParams): Mesh;
}
60 changes: 60 additions & 0 deletions types/components/meshes/Tube.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import {MeshComponent, MeshComponentParams} from '../../core/MeshComponent';
import {
LineCurve3,
Mesh,
TextGeometry
} from 'three';

interface TubeParams extends MeshComponentParams {

/** Parameters */
geometry?: {

/**
* Curve - A path that inherits from the Curve base class
* Default is LineCurve3(new Vector3(0, 0, 0), new Vector3(0, 0, 1)).
*/
path?: LineCurve3;

/**
* The number of segments that make up the tube.
* Default is 20.
*/
segments?: number;

/**
* The radius of the tube.
* Default is 2.
*/
radius?: number;

/**
* The number of segments that make up the cross-section.
* Default is 8.
*/
radiusSegments?: number;

/**
* Is the tube open or closed.
* Default is false.
*/
closed?: boolean;



}
}

export class Tube extends MeshComponent {
/**
* @constructor Creates a tube that extrudes along a 3d curve.
* @param params
*/
constructor(params?: TubeParams);

/**
* Build lifecycle creates a mesh using input params.
* @param params
*/
build(params?: TubeParams): Mesh;
}
8 changes: 6 additions & 2 deletions types/components/meshes/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
export * from './Box';
export * from './Sphere';
export * from './Cone';
export * from './Text';
export * from './Sphere';
export * from './Text';
export * from './Tetrahedron';
export * from './Torus';
export * from './Torusknot';
export * from './Tube';

0 comments on commit 0d70c54

Please sign in to comment.