Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Himanshu #1

Open
wants to merge 28 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
443193c
draft using tkinter
May 28, 2019
d2c776c
function to draw line
EthereousNatsuDragneel Jun 18, 2019
38a1ea2
Text rotates with the line
EthereousNatsuDragneel Jun 18, 2019
26c5578
Fixed the error in sabertooth
EthereousNatsuDragneel Jun 20, 2019
18c7b48
updated label display
himanshugarg Jun 20, 2019
9136f72
added label to the line
EthereousNatsuDragneel Jun 21, 2019
7591979
InputSpec Line
akashdeepbansal Jun 24, 2019
633a131
Lines Input Spec
akashdeepbansal Jun 25, 2019
ff5a869
Merge branch 'InputSpec' into himanshu
EthereousNatsuDragneel Jun 25, 2019
0d5bc03
label, measurement, angles
EthereousNatsuDragneel Jun 26, 2019
97010ae
t.py and draw.html replaced
EthereousNatsuDragneel Jun 28, 2019
db191de
calculate label positioning after calculating line coordinates, not u…
himanshugarg Jun 28, 2019
ddba870
a.html for the arrow using <marker>
EthereousNatsuDragneel Jun 28, 2019
47c0c68
sabertooth with line style prop
EthereousNatsuDragneel Jun 28, 2019
81a61f7
Changed sabertooth.py code to functions
EthereousNatsuDragneel Jul 8, 2019
7b4be7d
Extensions fixed
EthereousNatsuDragneel Jul 15, 2019
33b2c7c
to fix the line length bug
EthereousNatsuDragneel Jul 23, 2019
94dc8d1
Angles fixed, length fixed, added stroke-width
EthereousNatsuDragneel Jul 29, 2019
fb7a2ea
Introduced v1 and v2 for a line
EthereousNatsuDragneel Jul 29, 2019
17721f8
points are working
EthereousNatsuDragneel Jul 30, 2019
20ffc65
restructured the code
EthereousNatsuDragneel Jul 30, 2019
b4c256f
class line completed
EthereousNatsuDragneel Jul 31, 2019
c787a47
Fixed extension angle glitch
EthereousNatsuDragneel Aug 7, 2019
5076e20
extension glitch fixed
EthereousNatsuDragneel Aug 9, 2019
6f468bd
circle, imcomplete, line some changes
EthereousNatsuDragneel Sep 2, 2019
17a76ad
Line changes done
EthereousNatsuDragneel Sep 18, 2019
8611fcc
bugs fixed for line
EthereousNatsuDragneel Sep 18, 2019
01b78ea
Circle almost complete
EthereousNatsuDragneel Sep 23, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions a.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg">
<defs>
<!-- arrowhead marker definition -->
<marker id="arrow" viewBox="0 0 60 60" refX="30" refY="30"
markerWidth="20" markerHeight="20"
orient="auto-start-reverse">
<path d="M 0 0 L 10 5 L 0 10 z" />
</marker>
</defs>

<!-- Coordinate axes with a arrowhead in both direction -->
<polyline points="10,10 10,90 90,90" fill="none" stroke="black"
marker-start="url(#arrow)" marker-end="url(#arrow)" />
</svg>
238 changes: 238 additions & 0 deletions documents/input specs/Discussion.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,238 @@
NCERT Class 10th Chapter 6 Triangles

Note:I think we should have an extend() function so that the user can extend a line without having to deal with the angle and making it look like a real extension
Note: We should not rotate the 'measurement' with the line, like they've write it straight (0°) in the math book even for bent lines

Fig6.1 (ii) :
s1=square(side=100)
s2=square(side=60,center=s1.center)

Fig 6.1 (iii):
t1=triangle(side=70)
Note: I think it would be quite efficient if the user writes just one side, we make an equilateral triangle, if two-isosceles and if all 3 we make skelene triangle
t2=triangle(side=50,center=t1.center)

Fig 6.2:
l1=line(length=50,label="AD")
l2=line(angle=-90,length=50)
l3=line(angle=-10,y1=l2.y1,length=70,label="BC")
l4=line(x1=l3.x1,y1=l3.y1,x2=l1.x2,y2=l1.y2)

Fig 6.5:
t=trapezium(side1=30,side2=40,distance=50,markAngles="all",label="ABCD")
Note: We can have specific parameters if we want only one angle to be marked

Fig 6.6:
s=square(side=50,label="ABCD",shadeCorners="all")
Note: Similar to how we mark angles

Fig 6.7:
s=square(side=50,label="ABCD")

Fig 6.7 2nd part:
p=parallelogram(side1=40,side2=50,angle=50,label="PQRS)

Fig 6.8:
p=parallelogram(side=40,side=40,angle=60,label="PQRS")

Fig 6.9:
t=triangle(side=50,label="ABC")
e=extend(direction="forward",type="solid",t.side1,20)
e2=extend(direction="forward",type="solid",t.side3,20)
l=line(startpoint=midpoint(t.side1),endpoint=midpoint(t.side3))

Fig 6.11:
t=triangle(side=50,angle=-10,markAngles=t.v1,label="BCA")
e1=extend(direction="forward",t.side1,type="solid",cap="arrow",length=20)
e2=extend(direction="forward",t.side3,type="solid",cap="arrow",length=20,direction="forward")

Fig 6.12:
t=triangle(type="right",side1=60,side2=80,angle=-30,label="BCA")
l1=line(startpoint=midpoint(t.side1),endpoint=midpoint(t.side2))
e1=extend(l1,direction="both",cap="arrow",type="solid")
l2=line(startpoint=midpoint(t.side1),endpoint=midpoint(t.side2,ratio="1:3"))
e2=extend(l2,direction="both",cap="arrow")
Note: default for 'type' with extend is "dotted"

Fig 6.13:
t=triangle(side=50,label="BCA")
l=line(startpoint=midpoint(t.side1),endpoint=midpoint(t.side3),type="dotted")
e=extend(l,cap="arrow",direction="both")

Fig 6.14:
l1=line(length=50,label="AB")
l2=line(angle=-90,length=50)
l3=line(angle=-10,y1=l2.y1,length=70,label="DC")
l4=line(x1=l3.x1,y1=l3.y1,x2=l1.x2,y2=l1.y2)
l5=line(startpoint=midpoint(l2,ratio="2:5"),endpoint=midpoint(l4,ratio="2:5"),label="EF")

Fig 6.14:
t=triangle(side=60,label="QRP",markAngles=t.v2)
l=line(startpoint=midpoint(t.side1),endpoint=midpoint(t.side3),label="ST")
a=angle(l,t.side1)
Note: by default the angle() function will mark the smaller angle

Fig 6.15:
t=trapezium(side1=30,side2=50,distance=40,labels="DCBA",diagonal{v2,v4,"d1",dotted})
l=line(startpoint=midpoint({v1,v4}),endpoint=midpoint({v2,v3}))
Note: Having diagonal inside the brackets will make it difficult to access each of its properties such as dotted line or solid line, cap style, labels, naming etc

Fig 6.17:
t=triangle(side1=30,side2=40,label="BCA",markAngles=v2)
l=line(startpoint=midpoint(t.side2),label="DE",parallelTo=t.side1)
e=extend(l,direction="both",cap="arrow",length=30,type="solid")
a=angle(l,t.side3)

Fig 6.17 (ii):
t=triangle(side=50,label="BCA")
l=line(startpoint=midpoint(t.side3),endpoint=midpoint(t.side2),label="DE")
e=extend(l,direction="both",type="solid",length=20)

Fig 6.18:
k=kite(side1=30,side2=50,label="DCBA")
l1=line(startpoint=k.v2,endpoint=k.v4)
l2=line(startpoint=midpoint({k.v3,k.v4}),endpoint=midpoint({k.v2,k.v4}),label="ML")
l3=line(startpoint=midpoint({k.v2,k.v4}),endpoint=midpoint({k.v1,k.v4}),label=" N")
Note: I gave a space in label so that space is written instead of a label, or simply so that 'L' doesn't appear twice at the same point. We can also assign a special character that denotes "null"

Fig 6.19:
t=triangle(side=60,label="BCA")
l1=line(startpoint=t.v3,endpoint=midpoint(t.side1),label=" E")
l2=line(startpoint=l1.endpoint,endpoint=midpoint(t.side3))
l3=line(startpoint=l2.endpoint,endpoint=midpoint({t.v1,l1.endpoint}),label="DF")

Note: I think we should have a "copy()" or "similar()" function to copy similar shapes which are slightly different. Eg. Two congruent triangles that have a common point, we can just do copy() like:
t2=copy(t1,v1=t1.v1)

Trying to integrate medians/diagonals etc within the main functions:

Fig 6.20:
t1=triangle(side=50,label="QRP",midpointLine(side2,side3,name="m",label="EF"))
t2=triangle(base=t1.side1,side2=20,label=" O")
t3=triangle(base=t1.m,side2=10,label=" D")
l=line(startpoint=t2.v3,endpoint=t1.v3)
Note: we'll have to use dynamic variable naming with this

Fig 6.21:
t1=triangle(side=50,label="QRP")
t=trapezium(side1=t1.side1,side2=40,distance=10,label=" CB")
t2=triangle(base=t.base2,side=30,label=" O")
t3=triangle(base=t.side2,side=40,label=" A")
l=line(startpoint=t2.v3,endpoint=t1.t3)

Fig 6.22:
t=triangle(side=50,label="BCA",markAngle=v1,markAngle=v2,markAngle=v3)
Note: opposed to angle() function, we can have this property that would allow the user to mark and differentiate between three angles by default

Fig 6.23:
t=triangle(side=50,label="BCA",markAngle={v1,v2})
e1=extend(t.side2,direction="forward",length=20,type="solid",cap="arrow")
e2=extend(t.side3,direction="backward",type="solid",cap="arrow",length=20)
Note: Using {} and writing two values separated by ',' will mark two or more angles as equal angles

Fig 6.24
t=triangle(side=40,label="BCA")

Another alternate way for midpointLine():

Fig 6.24 (under the first one, not marked):
t=triangle(side=50,label="EFD",midpointLine=line(startpoint=midpoint(side2),endpoint=midpoint(side3),type="dotted",label="QP")

Fig 6.25:
t=triangle(side1=30,side2=50,side3=20,label="BCA")

Fig 6.26:
t1=triangle(side=30,label="BCA")
t2=triangle(v1=t1.x1+100,side=50,label="EFD",midpointline(side2,side3,type="dotted",label="PQ")
Note: I feel the idea you gave about having nested functions like above is easier to understand

Fig 6.27 (lower one):
t=triangle(side1=40,side2=60,side3=30,label="EFD",markAngles=v3,side2.measurement="6cm",side3.measurement="3cm")

Fig 6.28 (right one):
t=triangle(side=50,label="EFD",midpointLine(side2,side3,ratio="4:1",label="PQ",type="dotted"))

Fig 6.29:
t1=triangle(side=30,label="PQO",angle=-90)
t2=copy(t1,v3=t1.v3,label="SR ")
Note: The labelling will happen before the figure is rotated by the given angle

Fig 6.30:
t=triangle(side=50,label='BCA',markAngle={v1,v3})

=================================================================================================================t = triangle(length=('6','3\sqrt{3}','3.8'),angle=('60',-,'80'),label='BCA',baseAngle=0)
OR
l1 = line(label="AB",length='3.8',angle='0')
l2 = line(label="BC",length='6',svg={stroke-width=2})
l3 = line(label="CA",length='3\sqrt{3}')
t = triangle(l1,l2,l3,angles=((l1,l3,60),(l2,l3,80)))

---------------------------------------------------------------------------------------
Manjot --
1. lengthy code in second case
2. finding hard to associate
------------------------------------------------------------------------------------------------------

label = ' l' or (,'l') ' l'
label = 'BCA' or ('B','C','A') or 'B C A'

style = dotted, dotted-aarowed, dotted-right-arrowed, dotted-left-arrowed
OR
style = dotted
arrow = forward, backward, both, none

---------------------------------------------------------------------------------------------
Manjot - Prefer second one -- seems simple
---------------------------------------------------------------------------------------------

Visual parameters
l2 = line(label="BC",length='6',svg={stroke-width=4,stroke=red})
OR
thickness vs stroke-width
color vs stroke
as parameters of our object itself

-------------------------------------------------------------------------------------
1. We didn't need to parse, as they have no semantic
2. learning curve, he/she needs to remember that which is core tool command and which is svg
3. misuse of svg functionality
4. We can focus more on semantic, whereas tool will also support visual effects from the first day

Manjot -- preferred second one. Still we can implement svg
-----------------------------------------------------------------------------------------------------

Point on Circle Periphery
point(location=perimeter, angle=-60, label='P')
OR
point(location=perimeter, ratio='5:7', label='P')



triangle{
label
length
angle
baseAngle
Style
showLengths = None (default), 'all', 'AB,BC', (l1,l2)
showAngles = None (default), 'all', 'all_', (v1_,v3_), 'A_,C_' -- _ is for values, all and all_ can be variables
}

line(
label = 'A,B', 'l', ',l', 'l,'
length = 20 (default: cm), 20in, 20px, 20m, 20cm, 20km, 20mi, 20mm,
angle - 60 (default: degree), 60r, 60d
style = solid, dashed
arrows = None (default), (ratio='5:7',direction='forward', 'backward', v1, v2, 'A', 'B') -- for both sides ((direction='forward'),(direction='backward'))
showLength = False (default), True
points = (ratio = '5:7', label = 'P') -- for more multiple points, we can use list of arrays
extension = (direction = 'forward', 'backward', v1, v2, 'A', 'B',
line = {length = 4cm, style = dashed}
)
)

Cicle{
point = (ratio, label, location, angle)
}

object property checks - angles doesn't follow line lengths
Loading