# `class WMBond extends WMObjBase`

Available on all platforms

Bond object; a cylinder.

See `WMBase` and `WMObjBase` classes for inheritted parameters.

## Instance Fields

### `var dashed:Int`

whether the bond is dashed line. default is false, solid line (cylinder) is used.

### `var exclude:Bool`

whether skip drawing bottom and top faces. default is false.

### `var opos0:Point3D`

original position of a terminal; currently not intensively used

### `var opos1:Point3D`

original position of another terminal; currently not intensively used

### `var pos0:Point3D`

position of a terminal

### `var pos1:Point3D`

position of another terminal

### `var rounded:Bool`

whether put spheres on top and bottom faces; default is true.

### `function new(r:Float, c0:Int, c1:Int, a:Float, o:Float, q:Int, ag:Float, d:Float, sp:Float, gl:Float, sh:String):Void`

Constructor. Parameters are listed below, where values in parenthesis are default values.

- r: radius (1.0)
- c0: first color (0x00FF00; lime) (pos0 side is filled with this color)
- c1: second color (0x00FF00; lime) (pos1 side is filled with this color)
- a: alpha (1.0, opaque)
- o: offset (0.0)
- q: quality (0)
- ag: ambient intensity (0.4)
- d: diffuse intensity (0.5)
- sp: specular intensity (0.2)
- gl: gloss (30.0)
- sh: shader type ("Phong")

### `function absmax():Point3D`

absolute max of position: max(abs(x),abs(y),abs(z))

### `function clear(def:WMDefaults):Void`

initialize variables, if `def` is given, values of `def` is used as default.

### `function clone():WMBond`

returns a copy of this instance

### `function dump():String`

dump data of this instance in xml format

### `function gen(c:Context3D, is_dc_active:Bool):Void`

generate polygon and set corresponding shaders; this function calls `pregen` and `gen2`.

### `function gen2(c:Context3D, is_dc_active:Bool):Void`

generate polygon and shader. Call `pregen` function before. This function should not be called explicitly unless you are using multiple Workers.

### `function getDataSize():Int`

predefined cost for drawing; return always 15.

### `function get_dashed():Int`

getter of `dashed`

### `function get_exclude():Bool`

getter of `exclude`

### `function get_opos0():Point3D`

getter of `opos0`

### `function get_opos1():Point3D`

getter of `opos1`

### `function get_pos0():Point3D`

getter of `pos0`

### `function get_pos1():Point3D`

getter of `pos1`

### `function get_rounded():Bool`

getter of `rounded`

### `function loadFromXml(x:Xml, def:WMDefaults):Void`

load from XML; if `def` is given, that is used as initial value. See also `clear` function of this class.

### `function loadFromXmlOverwrite(x:Xml):Void`

read XML while overriding default values; this function does not read WMAtom specific fields. Use `loadFromXmlWOClear` when loading WMAtom specific fields.

### `function loadFromXmlWOClear(x:Xml):Void`

load XML data; usually this function is called by loadFromXml function

### `function num():Int`

number of elements inside; return always 2.

### `function pregen():Void`

preparation for generating polygon. This function is explicitly used in non-primordial Worker, where Context3D of the primordial Worker is not available. If Worker is not used, this function should not be called explicitly.

### `function scaleCoord(scale:Float):Void`

scale position by `scale`

### `function set_dashed(d:Int):Int`

setter of `dashed`

### `function set_exclude(e:Bool):Bool`

setter of `exclude`

### `function set_opos0(p:Point3D):Point3D`

setter of `opos0`

### `function set_opos1(p:Point3D):Point3D`

setter of `opos1`

### `function set_pos0(p:Point3D):Point3D`

setter of `pos0`

### `function set_pos1(p:Point3D):Point3D`

setter of `pos1`

### `function set_rounded(r:Bool):Bool`

setter of `rounded`

### `function sumPos():Point3D`

sum of position

### `function translate(p:Point3D):Void`

translate coordinate by `p`