feature: add IEC gates #11
Reference in New Issue
Block a user
No description provided.
Delete Branch "bono/circuiteria:add_iec_gates"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Hey 👋, here is an initial implementation of the IEC gates I mentioned in #10 .
Feel free to suggest/perform any improvement.
Hey 👋, this looks pretty good, thanks for contributing !
I would just try to simplify the drawing process, since they are basically rectangles (see following comments)
I'll also add examples for the manual in a future PR, or you can copy those for the other gates (see doc/examples.typ)
@ -0,0 +2,4 @@
#import "../ports.typ": add-ports, add-port
#import "../element.typ"
#let default-draw-shape(id, tl, tr, br, bl, fill, stroke, symbol) = {
Here you can simplify this function greatly by just drawing a rectangle:
@ -0,0 +112,4 @@
func
let space = 100% / inputs
for i in range(inputs) {
This for loop can also be simplified because we don't need to find intersections with the gate's contour (rectangular):
Typos in documentation refs
@ -0,0 +2,4 @@
#import "iec_gate.typ" as iec-gate
/// Draws an IEC buffer gate. This function is also available as `element.iec-gate-buf()`
Should be
element.gate-iec-buf
instead ofelement.iec-gate-buf
@ -0,0 +35,4 @@
)
}
/// Draws an IEC NOT gate. This function is also available as `element.iec-gate-not()`
Should be
element.gate-iec-not
instead ofelement.iec-gate-not
@ -0,0 +1,67 @@
#import "@preview/cetz:0.3.2": draw
#import "iec_gate.typ" as iec-gate
/// Draws an IEC-OR gate. This function is also available as `element.iec-gate-or()`
Should be
element.gate-iec-or
instead ofelement.iec-gate-or
@ -0,0 +34,4 @@
)
}
/// Draws an IEC-NOR gate. This function is also available as `element.iec-gate-nor()`
Should be
element.gate-iec-nor
instead ofelement.iec-gate-nor
@ -0,0 +1,67 @@
#import "@preview/cetz:0.3.2": draw
#import "iec_gate.typ" as iec-gate
/// Draws an IEC-XOR gate. This function is also available as `element.iec-gate-xor()`
Should be
element.gate-iec-xor
instead ofelement.iec-gate-xor
@ -0,0 +34,4 @@
)
}
/// Draws an IEC-NXOR gate. This function is also available as `element.iec-gate-nxor()`
Should be
element.gate-iec-xnor
instead ofelement.iec-gate-xnor
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.