Usage (signatures)
board.create('comb', [point1, point2]);
Parameters
| Name | Type | Description |
|---|---|---|
point1 |
PointLike | |
point2 |
PointLike |
Examples
// Create a simple horizontal comb with invisible endpoints
var c = board.create('comb', [[1, 0], [3, 0]]);
var p1 = board.create('glider', [-3, 0, board.defaultAxes.x]);
var p2 = board.create('glider', [-1, 0, board.defaultAxes.x]);
var c1 = board.create('comb', [p1, p2], {width: 0.2, frequency: 0.1, angle: Math.PI / 4});
var s = board.create('slider', [[1,3], [4,3], [0.1, 0.3, 0.8]]);
var p1 = board.create('glider', [-3, 0, board.defaultAxes.x]);
var p2 = board.create('glider', [-1, 0, board.defaultAxes.x]);
var c1 = board.create('comb', [p1, p2], {
width: function(){ return 4*s.Value(); },
reverse: function(){ return (s.Value()<0.5) ? false : true; },
frequency: function(){ return s.Value(); },
angle: function(){ return s.Value() * Math.PI / 2; },
strokeColor: 'red'
});
Attributes
Own
angle
- Description
Angle - given in radians - under which comb elements are positioned.
- Type
- Number
- Default Value
- Math.PI / 3 (i.e. π /3 or 60^° degrees)
- Source
- options.js, line 5096
frequency
- Description
Frequency of comb elements.
- Type
- Number
- Default Value
- 0.2
- Source
- options.js, line 5076
point1
- Description
Attributes for first defining point of the comb.
- Type
- Point
- Source
- options.js, line 5116
point2
- Description
Attributes for second defining point of the comb.
- Type
- Point
- Source
- options.js, line 5130
reverse
- Description
Should the comb go right to left instead of left to right.
- Type
- Boolean
- Default Value
- false
- Source
- options.js, line 5106
width
- Description
Width of the comb.
- Type
- Number
- Default Value
- 0.4
- Source
- options.js, line 5086
Inherited
Members
Own
none
Inherited
Events
Own
none
Inherited
Throws
-
If the element cannot be constructed with the given parent objects an exception is thrown.
- Type
- Error
Details
- Type
- JXG.Curve
- Source
- element/comb.js, line 38