Header menu logo issie

BlockHelpers Module

Types and nested modules

Type/Module Description

Constants

Rectangle

Type used to simplify BoundingBox intersection calculations

Functions and values

Function or value Description

addLengthToPos position orientation length

Full Usage: addLengthToPos position orientation length

Parameters:
Returns: XYPos
Modifiers: inline

Returns an XYPos shifted by length in an X or Y direction defined by orientation.

position : XYPos
orientation : Orientation
length : float
Returns: XYPos

connsBtwnSyms wModel symA symB

Full Usage: connsBtwnSyms wModel symA symB

Parameters:
Returns: Map<ConnectionId, Wire>

Gets connections between symbols. HLP23: AUTHOR dgs119

wModel : Model
symA : Symbol
symB : Symbol
Returns: Map<ConnectionId, Wire>

dotProduct p1 p2

Full Usage: dotProduct p1 p2

Parameters:
Returns: float
Modifiers: inline

Returns the dot product of 2 XYPos

p1 : XYPos
p2 : XYPos
Returns: float

filterPortBySym ports sym

Full Usage: filterPortBySym ports sym

Parameters:
Returns: Port list

Filters Ports by Symbol. HLP23: AUTHOR dgs119

ports : Port list
sym : Symbol
Returns: Port list

findPerpendicularDistance segStart segEnd point

Full Usage: findPerpendicularDistance segStart segEnd point

Parameters:
Returns: float
segStart : XYPos
segEnd : XYPos
point : XYPos
Returns: float

fixBoundingBox box

Full Usage: fixBoundingBox box

Parameters:
Returns: BoundingBox

Used to fix bounding box with negative width and heights HLP23: Derek Lai (ddl20)

box : BoundingBox
Returns: BoundingBox

foldOverNonZeroSegs folder state wire

Full Usage: foldOverNonZeroSegs folder state wire

Parameters:
    folder : XYPos -> XYPos -> 'a -> Segment -> 'a - The function to update the state given the segment start and end positions, current state and segment itself.
    state : 'a - The initial state.
    wire : Wire - The wire containing the segment list we are folding over.

Returns: 'a The final state value
Modifiers: inline
Type parameters: 'a

Applies a function which requires the segment start and end positions to the non-zero-length segments in a wire, threading an accumulator argument through the computation. Essentially a List.fold applied to the list of segments of a wire, but with access to each segment's absolute positions.

This is used in cases where absolute segment positions are required. These positions are computed on the fly and passed to the folder function.

folder : XYPos -> XYPos -> 'a -> Segment -> 'a

The function to update the state given the segment start and end positions, current state and segment itself.

state : 'a

The initial state.

wire : Wire

The wire containing the segment list we are folding over.

Returns: 'a

The final state value

foldOverSegs folder state wire

Full Usage: foldOverSegs folder state wire

Parameters:
    folder : XYPos -> XYPos -> 'a -> Segment -> 'a - The function to update the state given the segment start and end positions, current state and segment itself.
    state : 'a - The initial state.
    wire : Wire - The wire containing the segment list we are folding over.

Returns: 'a The final state value
Modifiers: inline
Type parameters: 'a

Applies a function which requires the segment start and end positions to the segments in a wire, threading an accumulator argument through the computation. Essentially a List.fold applied to the list of segments of a wire, but with access to each segment's absolute positions.

This is used in cases where absolute segment positions are required. These positions are computed on the fly and passed to the folder function.

folder : XYPos -> XYPos -> 'a -> Segment -> 'a

The function to update the state given the segment start and end positions, current state and segment itself.

state : 'a

The initial state.

wire : Wire

The wire containing the segment list we are folding over.

Returns: 'a

The final state value

getAbsSegments wire

Full Usage: getAbsSegments wire

Parameters:
Returns: ASegment list

Return absolute segment list from a wire. NB - it is often more efficient to use various fold functions (foldOverSegs etc)

wire : Wire
Returns: ASegment list

getCompId model portId

Full Usage: getCompId model portId

Parameters:
    model : Model
    portId : string

Returns: ComponentId
Modifiers: inline
model : Model
portId : string
Returns: ComponentId

getConnSyms wModel

Full Usage: getConnSyms wModel

Parameters:
Returns: (Symbol * Symbol) list

Get pairs of unique symbols that are connected to each other. HLP23: AUTHOR dgs119

wModel : Model
Returns: (Symbol * Symbol) list

getCopiedSymbols symModel

Full Usage: getCopiedSymbols symModel

Parameters:
Returns: ComponentId list

Interface function to get componentIds of the copied symbols

symModel : Model
Returns: ComponentId list

getFilteredAbsSegments includeSegment wire

Full Usage: getFilteredAbsSegments includeSegment wire

Parameters:
Returns: ASegment list

Return filtered absolute segment list from a wire. includeSegment determines whether a given segment is included in the output list. NB this is more efficient than generating the whole lits and then filtering.

includeSegment : Orientation -> Segment -> bool
wire : Wire
Returns: ASegment list

getInputPortIdStr portId

Full Usage: getInputPortIdStr portId

Parameters:
Returns: string
Modifiers: inline
portId : InputPortId
Returns: string

getInputPortOrientation model portId

Full Usage: getInputPortOrientation model portId

Parameters:
Returns: Edge
Modifiers: inline
model : Model
portId : InputPortId
Returns: Edge

getNonZeroAbsSegments wire

Full Usage: getNonZeroAbsSegments wire

Parameters:
Returns: ASegment list

Return absolute segment list from a wire. NB - it is often more efficient to use various fold functions (foldOverSegs etc)

wire : Wire
Returns: ASegment list

getOutputPortIdStr portId

Full Usage: getOutputPortIdStr portId

Parameters:
Returns: string
Modifiers: inline
portId : OutputPortId
Returns: string

getOutputPortOrientation model portId

Full Usage: getOutputPortOrientation model portId

Parameters:
Returns: Edge
Modifiers: inline
model : Model
portId : OutputPortId
Returns: Edge

getPort symModel portId

Full Usage: getPort symModel portId

Parameters:
    symModel : Model
    portId : string

Returns: Port
Modifiers: inline

Returns the port object associated with a given portId

symModel : Model
portId : string
Returns: Port

getPortIdStr portId

Full Usage: getPortIdStr portId

Parameters:
Returns: string
Modifiers: inline

Returns the string of a PortId

portId : PortId
Returns: string

getPortOrientation model portId

Full Usage: getPortOrientation model portId

Parameters:
Returns: Edge
Modifiers: inline

returns what side of the symbol the port is on

model : Model
portId : PortId
Returns: Edge

getPortOrientationFrmPortIdStr model portIdStr

Full Usage: getPortOrientationFrmPortIdStr model portIdStr

Parameters:
    model : Model
    portIdStr : string

Returns: Edge
Modifiers: inline

HLP23: AUTHOR dgs119

model : Model
portIdStr : string
Returns: Edge

getSourcePort model wire

Full Usage: getSourcePort model wire

Parameters:
Returns: Port
Modifiers: inline
model : Model
wire : Wire
Returns: Port

getSourceSymbol model wire

Full Usage: getSourceSymbol model wire

Parameters:
Returns: Symbol
Modifiers: inline
model : Model
wire : Wire
Returns: Symbol

getStartAndEndWirePos wire

Full Usage: getStartAndEndWirePos wire

Parameters:
Returns: XYPos * XYPos

Get the start and end positions of a wire. HLP23: AUTHOR Jian Fu Eng (jfe20)

wire : Wire
Returns: XYPos * XYPos

getSymbol model portId

Full Usage: getSymbol model portId

Parameters:
    model : Model
    portId : string

Returns: Symbol
Modifiers: inline
model : Model
portId : string
Returns: Symbol

getSymbolPos symbolModel compId

Full Usage: getSymbolPos symbolModel compId

Parameters:
Returns: XYPos

Returns the center coordinates of a Symbol

symbolModel : Model
compId : ComponentId
Returns: XYPos

getTargetPort model wire

Full Usage: getTargetPort model wire

Parameters:
Returns: Port
Modifiers: inline
model : Model
wire : Wire
Returns: Port

getTargetSymbol model wire

Full Usage: getTargetSymbol model wire

Parameters:
Returns: Symbol
Modifiers: inline
model : Model
wire : Wire
Returns: Symbol

getWireLength wire

Full Usage: getWireLength wire

Parameters:
Returns: float

Returns length of wire HLP23: AUTHOR Jian Fu Eng (jfe20)

wire : Wire
Returns: float

getWireSegmentsXY wire

Full Usage: getWireSegmentsXY wire

Parameters:
Returns: XYPos list

Retrieves XYPos of every vertex in a wire HLP23: Derek Lai (ddl20)

wire : Wire
Returns: XYPos list

getWiresInBox box model

Full Usage: getWiresInBox box model

Parameters:
Returns: (Wire * int) list

Retrieves all wires which intersect an arbitrary bounding box & the index of the segment which intersects the box HLP23: Derek Lai (ddl20)

box : BoundingBox
model : Model
Returns: (Wire * int) list

getXY pos

Full Usage: getXY pos

Parameters:
Returns: float * float
Modifiers: inline

Returns the X and Y fields of an XYPos as a pair of floats

pos : XYPos
Returns: float * float

groupWiresByNet conns

Full Usage: groupWiresByNet conns

Parameters:
Returns: Wire list list

Groups Wires by the net they belong to. HLP23: AUTHOR dgs119

conns : Map<ConnectionId, Wire>
Returns: Wire list list

inMiddleOf a x b

Full Usage: inMiddleOf a x b

Parameters:
    a : float
    x : float
    b : float

Returns: bool
Modifiers: inline

Returns true if x lies in the open interval (a,b). Endpoints are avoided by a tolerance parameter

a : float
x : float
b : float
Returns: bool

inMiddleOrEndOf a x b

Full Usage: inMiddleOrEndOf a x b

Parameters:
    a : float
    x : float
    b : float

Returns: bool
Modifiers: inline

Returns true if a lies in the closed interval (a,b). Endpoints are included by a tolerance parameter

a : float
x : float
b : float
Returns: bool

inputPortStr arg1

Full Usage: inputPortStr arg1

Parameters:
Returns: string
Modifiers: inline
arg0 : InputPortId
Returns: string

isConnBtwnSyms wire symA symB

Full Usage: isConnBtwnSyms wire symA symB

Parameters:
Returns: bool

Checks if wire is connected to two given symbols. Returns false if two Symbols are the same. HLP23: AUTHOR dgs119

wire : Wire
symA : Symbol
symB : Symbol
Returns: bool

isPortInSymbol portId symbol

Full Usage: isPortInSymbol portId symbol

Parameters:
    portId : string
    symbol : Symbol

Returns: bool

Checks if a port is part of a Symbol. HLP23: AUTHOR dgs119

portId : string
symbol : Symbol
Returns: bool

isWireInNet model wire

Full Usage: isWireInNet model wire

Parameters:
Returns: (OutputPortId * (ConnectionId * Wire) list) option

Checks if a wire is part of a net. If yes, return the netlist. Otherwise, return None HLP23: AUTHOR Jian Fu Eng (jfe20)

model : Model
wire : Wire
Returns: (OutputPortId * (ConnectionId * Wire) list) option

lThanEqualPos p1 p2

Full Usage: lThanEqualPos p1 p2

Parameters:
Returns: bool
Modifiers: inline

Returns true if p1 is less than or equal to p2 (has both smaller X and Y values

p1 : XYPos
p2 : XYPos
Returns: bool

moveSymbol offset sym

Full Usage: moveSymbol offset sym

Parameters:
Returns: Symbol
offset : XYPos
sym : Symbol
Returns: Symbol

moveSymbols offset model

Full Usage: moveSymbols offset model

Parameters:
Returns: Model
offset : XYPos
model : Model
Returns: Model

moveWire wire displacement

Full Usage: moveWire wire displacement

Parameters:
Returns: Wire

Moves a wire by the XY amounts specified by displacement

wire : Wire
displacement : XYPos
Returns: Wire

moveWires offset model

Full Usage: moveWires offset model

Parameters:
Returns: Model
offset : XYPos
model : Model
Returns: Model

outputPortStr arg1

Full Usage: outputPortStr arg1

Parameters:
Returns: string
Modifiers: inline
arg0 : OutputPortId
Returns: string

overlap1D (arg1, arg2) (arg3, arg4)

Full Usage: overlap1D (arg1, arg2) (arg3, arg4)

Parameters:
    arg0 : float
    arg1 : float
    arg2 : float
    arg3 : float

Returns: bool

Returns true if two 1D line segments intersect HLP23: Derek Lai (ddl20)

arg0 : float
arg1 : float
arg2 : float
arg3 : float
Returns: bool

overlap2D (arg1, arg2) (arg3, arg4)

Full Usage: overlap2D (arg1, arg2) (arg3, arg4)

Parameters:
Returns: bool

Returns true if two Boxes intersect, where each box is passed in as top right and bottom left XYPos tuples HLP23: Derek Lai (ddl20)

arg0 : XYPos
arg1 : XYPos
arg2 : XYPos
arg3 : XYPos
Returns: bool

overlap2DBox bb1 bb2

Full Usage: overlap2DBox bb1 bb2

Parameters:
Returns: bool

Returns true if two Boxes intersect, where each box is passed in as a BoundingBox HLP23: Derek Lai (ddl20)

bb1 : BoundingBox
bb2 : BoundingBox
Returns: bool

partitionWiresIntoNets model

Full Usage: partitionWiresIntoNets model

Parameters:
Returns: (OutputPortId * (ConnectionId * Wire) list) list
model : Model
Returns: (OutputPortId * (ConnectionId * Wire) list) list

portsOfWires model wires

Full Usage: portsOfWires model wires

Parameters:
Returns: Port list

Gets Ports From a List of Wires. HLP23: AUTHOR dgs119

model : Model
wires : Wire list
Returns: Port list

rectanglesIntersect rect1 rect2

Full Usage: rectanglesIntersect rect1 rect2

Parameters:
Returns: bool

Checks if 2 rectangles intersect

rect1 : Rectangle
rect2 : Rectangle
Returns: bool

scalePos factor pos

Full Usage: scalePos factor pos

Parameters:
    factor : float
    pos : XYPos

Returns: XYPos
Modifiers: inline

Returns pos with the X and Y fields scaled by factor (I didn't like the order of parameters for the * operator in XYPos)

factor : float
pos : XYPos
Returns: XYPos

segmentIntersectsBoundingBox box segStart segEnd

Full Usage: segmentIntersectsBoundingBox box segStart segEnd

Parameters:
Returns: float option

Checks if a segment intersects a bounding box using the segment's start and end XYPos return how close teh segment runs to the box centre, if it intersects

box : BoundingBox
segStart : XYPos
segEnd : XYPos
Returns: float option

segmentsToIssieVertices segList wire

Full Usage: segmentsToIssieVertices segList wire

Parameters:
Returns: (float * float * bool) list

Converts a segment list into a list of vertices to store inside Connection

segList : Segment list
wire : Wire
Returns: (float * float * bool) list

setCustomCompHW h w sym

Full Usage: setCustomCompHW h w sym

Parameters:
    h : float
    w : float
    sym : Symbol

Returns: Symbol

Scales a symbol so it has the provided height and width. HLP23: AUTHOR BRYAN TAN

h : float
w : float
sym : Symbol
Returns: Symbol

squaredDistance p1 p2

Full Usage: squaredDistance p1 p2

Parameters:
Returns: float
Modifiers: inline

Returns the squared distance between 2 points using Pythagoras

p1 : XYPos
p2 : XYPos
Returns: float

switchOrientation orientation

Full Usage: switchOrientation orientation

Parameters:
Returns: Orientation
Modifiers: inline

Returns the opposite orientation of the input orientation. (i.e. Horizontal becomes Vertical and vice-versa)

orientation : Orientation
Returns: Orientation

toX pos

Full Usage: toX pos

Parameters:
Returns: float
Modifiers: inline

Returns the X-value of an XYPos

pos : XYPos
Returns: float

toY pos

Full Usage: toY pos

Parameters:
Returns: float
Modifiers: inline

Returns the Y-value of an XYPos

pos : XYPos
Returns: float

totalLengthOfWires conns

Full Usage: totalLengthOfWires conns

Parameters:
Returns: float

Gets total length of a set of wires. HLP23: AUTHOR dgs119

conns : Map<ConnectionId, Wire>
Returns: float

updateModelSymbols model symbols

Full Usage: updateModelSymbols model symbols

Parameters:
Returns: Model

Update BusWire model with given symbols. Can also be used to add new symbols. This uses a fold on the Map to add symbols which makes it fast in the case that the number of symbols added is very small.

model : Model
symbols : Symbol list
Returns: Model

updateModelWires model wiresToAdd

Full Usage: updateModelWires model wiresToAdd

Parameters:
Returns: Model

Update BusWire model with given wires. Can also be used to add new wires. This uses a fold on the Map to add wires which makes it fast in the case that the number of wires added is small.

model : Model
wiresToAdd : Wire list
Returns: Model

wireSymEdge wModel wire sym

Full Usage: wireSymEdge wModel wire sym

Parameters:
Returns: Edge

For a wire and a symbol, return the edge of the symbol that the wire is connected to. /// HLP23: AUTHOR BRYAN TAN

wModel : Model
wire : Wire
sym : Symbol
Returns: Edge

wiresBtwnSyms wModel symA symB

Full Usage: wiresBtwnSyms wModel symA symB

Parameters:
Returns: Wire list

Gets Wires between symbols. HLP23: AUTHOR dgs119

wModel : Model
symA : Symbol
symB : Symbol
Returns: Wire list

Type extensions

Type extension Description

this.EndOrientation

Full Usage: this.EndOrientation

Parameters:
    () : unit

Returns: Orientation
Modifiers: inline

Extended Type: Wire

() : unit
Returns: Orientation

this.EndOrientation

Full Usage: this.EndOrientation

Returns: Orientation
Modifiers: inline

Extended Type: Wire

Returns: Orientation

this.EndPos

Full Usage: this.EndPos

Parameters:
    () : unit

Returns: XYPos
Modifiers: inline

Extended Type: Wire

() : unit
Returns: XYPos

this.EndPos

Full Usage: this.EndPos

Returns: XYPos
Modifiers: inline

Extended Type: Wire

Returns: XYPos

Type something to start searching.