Skip to main content

Class: ConvexHullProducer

ConvexHullProducer()

Provides parallel convex hulls path building over all available CPU cores## Constructor

new ConvexHullProducer()

Extends

  • Threads.ThreadPool

Methods

(async) broadcast()

Bulk execution of action to all workers

Overrides:

  • Threads.ThreadPool#broadcast

(async) build(path, type, lastPolygon)

Parameters:
NameTypeDescription
pathPathBuilding.InkPath2D
typePathBuilding.Pipeline.SegmentType
lastPolygonboolean

(abstract) buildRequestMessage() → {any}

Build message for particular action. Implementation is not required. broadcast relies on this method.

Overrides:

  • Threads.ThreadPool#buildRequestMessage
Returns:

message Worker request

Type

any

close()

Terminate all underlying workers

Overrides:

  • Threads.ThreadPool#close

(async) open(srcopt)

Generate n workers based on CPU cores. Invokes worker INIT action.

Parameters:
NameTypeAttributesDescription
srcURI<optional>Worker location.Defaults to /node_modules/digital-ink/workers/${name}Param is required in DedicatedWorkerGlobalScope.It is also required when underlying env is not connected with node_modules structure.

Overrides:

  • Threads.ThreadPool#open

(abstract) recieve(message)

Worker response handler

Parameters:
NameTypeDescription
messageanyWorker response

Overrides:

  • Threads.ThreadPool#recieve

reject()

Action reject

Overrides:

  • Threads.ThreadPool#reject

resolve(value)

Action resolve

Parameters:
NameTypeDescription
valueanyProduced value

Overrides:

  • Threads.ThreadPool#resolve

send(index, message)

Send a message to particular worker

Parameters:
NameTypeDescription
indexintTarget worker. Property 'worker' in recieved message tells where response is coming from.
messageanyWorker request

Overrides:

  • Threads.ThreadPool#send

Home