Skip to content

Commit

Permalink
Mirrored up to long cell trap, but changing port location
Browse files Browse the repository at this point in the history
  • Loading branch information
ericx authored and ericx committed Feb 24, 2024
1 parent f24b475 commit 8381ea7
Show file tree
Hide file tree
Showing 10 changed files with 222 additions and 141 deletions.
64 changes: 37 additions & 27 deletions src/app/library/betterMixer.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import Template from "./template";
import paper from "paper";
import ComponentPort from "../core/componentPort";
import { LogicalLayerType } from "../core/init";
import { LogicalLayerType } from "../core/init";

export default class BetterMixer extends Template {
export default class CurvedMixer extends Template {
constructor() {
super();
}
Expand All @@ -20,53 +20,55 @@ export default class BetterMixer extends Template {
channelWidth: "Float",
bendLength: "Float",
rotation: "Float",
height: "Float"
height: "Float",
mirrorByX: "Float",
mirrorByY: "Float"
};

this.__defaults = {
componentSpacing: 1000,
rotation: 0,
channelWidth: 0.8 * 1000,
bendSpacing: 1.23 * 1000,
numberOfBends: 1,
rotation: 0,
bendLength: 2.46 * 1000,
height: 250
height: 250,
mirrorByX: 0,
mirrorByY: 0
};

this.__units = {
componentSpacing: "μm",
rotation: "°",
bendSpacing: "μm",
numberOfBends: "",
channelWidth: "μm",
bendLength: "μm",
rotation: "°",
height: "μm"
};

this.__minimum = {
componentSpacing: 0,
rotation: 0,
channelWidth: 10,
bendSpacing: 10,
numberOfBends: 1,
rotation: 0,
bendLength: 10,
height: 10
height: 10,
mirrorByX: 0,
mirrorByY: 0
};

this.__maximum = {
componentSpacing: 10000,
rotation: 360,
channelWidth: 2000,
bendSpacing: 6000,
numberOfBends: 20,
rotation: 360,
bendLength: 12 * 1000,
height: 1200
};

this.__placementTool = "componentPositionTool";

this.__toolParams = {
cursorPosition: "position"
height: 1200,
mirrorByX: 1,
mirrorByY: 1
};

this.__featureParams = {
Expand All @@ -76,7 +78,9 @@ export default class BetterMixer extends Template {
bendSpacing: "bendSpacing",
numberOfBends: "numberOfBends",
rotation: "rotation",
bendLength: "bendLength"
bendLength: "bendLength",
mirrorByX: "mirrorByX",
mirrorByY: "mirrorByY"
};

this.__targetParams = {
Expand All @@ -85,7 +89,15 @@ export default class BetterMixer extends Template {
bendSpacing: "bendSpacing",
numberOfBends: "numberOfBends",
rotation: "rotation",
bendLength: "bendLength"
bendLength: "bendLength",
mirrorByX: "mirrorByX",
mirrorByY: "mirrorByY"
};

this.__placementTool = "componentPositionTool";

this.__toolParams = {
position: "position"
};

this.__renderKeys = ["FLOW"];
Expand All @@ -107,17 +119,14 @@ export default class BetterMixer extends Template {
const bendSpacing = params.bendSpacing;
const rotation = params.rotation;
const numberOfBends = params.numberOfBends;

const ports = [];

ports.push(new ComponentPort(bendLength / 2 + channelWidth, 0, "1", LogicalLayerType.FLOW));

ports.push(new ComponentPort(bendLength / 2 + channelWidth, (2 * numberOfBends + 1) * channelWidth + 2 * numberOfBends * bendSpacing, "2", LogicalLayerType.FLOW));

this.mirrorPorts(params,ports)
return ports;
}

render2D(params: { [k: string]: any }, key: string): paper.CompoundPath {
render2D(params: { [k: string]: any }, key: string) {
const channelWidth = params.channelWidth;
const bendLength = params.bendLength;
const bendSpacing = params.bendSpacing;
Expand Down Expand Up @@ -149,15 +158,16 @@ export default class BetterMixer extends Template {
}

serp.fillColor = color;
this.mirrorRender(params,serp);
return (serp.rotate(rotation, new paper.Point(x, y)) as unknown) as paper.CompoundPath;
}

render2DTarget(key: string | null, params: { [k: string]: any }): paper.CompoundPath {
render2DTarget(key: string | null, params: { [k: string]: any }) {
if (key === null) {
key = this.__renderKeys[0];
}
const serp = this.render2D(params, key);
serp.fillColor!.alpha = 0.5;
return serp;
const render = this.render2D(params, key);
render.fillColor!.alpha = 0.5;
return render;
}
}
27 changes: 21 additions & 6 deletions src/app/library/celltrapL.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ export default class CellTrapL extends Template {
chamberWidth: "Float",
numberOfChambers: "Float",
chamberSpacing: "Float",
height: "Float"
height: "Float",
mirrorByX: "Float",
mirrorByY: "Float"
};

this.__defaults = {
Expand All @@ -32,7 +34,9 @@ export default class CellTrapL extends Template {
chamberWidth: 1.23 * 1000,
numberOfChambers: 6,
chamberSpacing: 2.46 * 1000,
height: 250
height: 250,
mirrorByX: 0,
mirrorByY: 0
};

this.__units = {
Expand All @@ -54,7 +58,9 @@ export default class CellTrapL extends Template {
numberOfChambers: 1,
chamberSpacing: 30,
height: 10,
rotation: 0
rotation: 0,
mirrorByX: 0,
mirrorByY: 0
};

this.__maximum = {
Expand All @@ -65,7 +71,9 @@ export default class CellTrapL extends Template {
numberOfChambers: 100,
chamberSpacing: 12 * 1000,
height: 1200,
rotation: 360
rotation: 360,
mirrorByX: 1,
mirrorByY: 1
};

this.__featureParams = {
Expand All @@ -77,7 +85,9 @@ export default class CellTrapL extends Template {
numberOfChambers: "numberOfChambers",
chamberSpacing: "chamberSpacing",
feedingChannelWidth: "feedingChannelWidth",
height: "height"
height: "height",
mirrorByX: "mirrorByX",
mirrorByY: "mirrorByY"
};

this.__targetParams = {
Expand All @@ -88,7 +98,9 @@ export default class CellTrapL extends Template {
numberOfChambers: "numberOfChambers",
chamberSpacing: "chamberSpacing",
feedingChannelWidth: "feedingChannelWidth",
height: "height"
height: "height",
mirrorByX: "mirrorByX",
mirrorByY: "mirrorByY"
};

this.__placementTool = "CellPositionTool";
Expand Down Expand Up @@ -125,6 +137,7 @@ export default class CellTrapL extends Template {

ports.push(new ComponentPort((numChambers / 2) * (chamberWidth + chamberSpacing) + chamberSpacing, chamberLength + feedingChannelWidth / 2, "2", LogicalLayerType.FLOW));

this.mirrorPorts(params,ports)
return ports;
}

Expand Down Expand Up @@ -183,6 +196,7 @@ export default class CellTrapL extends Template {
traps = new paper.CompoundPath(chamberList);
traps.fillColor = color;
traps.rotate(rotation, new paper.Point(x, y));
this.mirrorRender(params,traps);
return traps;
}

Expand Down Expand Up @@ -213,6 +227,7 @@ export default class CellTrapL extends Template {

chamberList.fillColor = color;
chamberList.rotate(rotation, new paper.Point(x, y));
this.mirrorRender(params,chamberList);
return chamberList;
}
}
26 changes: 17 additions & 9 deletions src/app/library/curvedMixer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ export default class CurvedMixer extends Template {
bendLength: "Float",
rotation: "Float",
height: "Float",
mirror: "Float"
mirrorByX: "Float",
mirrorByY: "Float"
};

this.__defaults = {
Expand All @@ -32,7 +33,8 @@ export default class CurvedMixer extends Template {
numberOfBends: 1,
bendLength: 2.46 * 1000,
height: 250,
mirror: 0
mirrorByX: 0,
mirrorByY: 0
};

this.__units = {
Expand All @@ -53,7 +55,8 @@ export default class CurvedMixer extends Template {
numberOfBends: 1,
bendLength: 10,
height: 10,
mirror: 0
mirrorByX: 0,
mirrorByY: 0
};

this.__maximum = {
Expand All @@ -64,7 +67,8 @@ export default class CurvedMixer extends Template {
numberOfBends: 20,
bendLength: 12 * 1000,
height: 1200,
mirror: 1
mirrorByX: 1,
mirrorByY: 1
};

this.__featureParams = {
Expand All @@ -74,7 +78,9 @@ export default class CurvedMixer extends Template {
bendSpacing: "bendSpacing",
numberOfBends: "numberOfBends",
rotation: "rotation",
bendLength: "bendLength"
bendLength: "bendLength",
mirrorByX: "mirrorByX",
mirrorByY: "mirrorByY"
};

this.__targetParams = {
Expand All @@ -83,7 +89,9 @@ export default class CurvedMixer extends Template {
bendSpacing: "bendSpacing",
numberOfBends: "numberOfBends",
rotation: "rotation",
bendLength: "bendLength"
bendLength: "bendLength",
mirrorByX: "mirrorByX",
mirrorByY: "mirrorByY"
};

this.__placementTool = "componentPositionTool";
Expand Down Expand Up @@ -117,6 +125,8 @@ export default class CurvedMixer extends Template {

ports.push(new ComponentPort(bendLength / 2 + channelWidth, (2 * numberOfBends + 1) * channelWidth + 2 * numberOfBends * bendSpacing, "2", LogicalLayerType.FLOW));

this.mirrorPorts(params,ports);

return ports;
}

Expand Down Expand Up @@ -192,9 +202,7 @@ export default class CurvedMixer extends Template {
serp.fillColor = color;
serp.rotate(rotation, new paper.Point(x, y));

if(params.mirror == 1){
serp.scale(-1,1)
}
this.mirrorRender(params,serp);

return serp;
}
Expand Down
Loading

0 comments on commit 8381ea7

Please sign in to comment.