# Make Shapes With SystemOfBobies

In [1]:
from xv.km.plotting import SystemOfBodies

In [2]:
s = SystemOfBodies('A 0 0')

In [3]:
s.plot('A')

Shape Name: A

In [4]:
s.replot()
s.plot('A', 'A')

Shape Name: A


### Create square

In [8]:
s.addPoints(('B 10 0', 'C 10 10', 'D 0 10'), overwrite = True)

In [9]:
s.replot()
s.plot('A B C D', 'ABCD')

Shape Name: A
Shape Name: B
Shape Name: C
Shape Name: D

In [10]:
s.replot()
s.plot('A B C D', 'ABCD')
s.plot('AB BC CD DA', 'ABCD')

Shape Name: A
Shape Name: B
Shape Name: C
Shape Name: D
Shape Name: AB
Segment2D AB:
Segment2D(Point2D(0, 0), Point2D(10, 0))

Shape Name: BC
Segment2D BC:
Segment2D(Point2D(10, 0), Point2D(10, 10))

Shape Name: CD
Segment2D CD:
Segment2D(Point2D(10, 10), Point2D(0, 10))

Shape Name: DA
Segment2D DA:
Segment2D(Point2D(0, 10), Point2D(0, 0))



### Create rectangle beside sqaure

In [15]:
s.addPoints(('E 12 0', 'F 35 0', 'G 35 10', 'H 12 10'), overwrite = True)

In [19]:
s.replot()
s.plot('A B C D', 'ABCD')
s.plot('AB BC CD DA', 'ABCD')
s.plot('E F G H', 'EFGH')
s.plot('EF FG GH HE')

Shape Name: A
Shape Name: B
Shape Name: C
Shape Name: D
Shape Name: AB
Segment2D AB:
Segment2D(Point2D(0, 0), Point2D(10, 0))

Shape Name: BC
Segment2D BC:
Segment2D(Point2D(10, 0), Point2D(10, 10))

Shape Name: CD
Segment2D CD:
Segment2D(Point2D(10, 10), Point2D(0, 10))

Shape Name: DA
Segment2D DA:
Segment2D(Point2D(0, 10), Point2D(0, 0))

Shape Name: E
Shape Name: F
Shape Name: G
Shape Name: H
Shape Name: EF
Segment2D EF:
Segment2D(Point2D(12, 0), Point2D(35, 0))

Shape Name: FG
Segment2D FG:
Segment2D(Point2D(35, 0), Point2D(35, 10))

Shape Name: GH
Segment2D GH:
Segment2D(Point2D(35, 10), Point2D(12, 10))

Shape Name: HE
Segment2D HE:
Segment2D(Point2D(12, 10), Point2D(12, 0))



### Create triangle inside rectangle

In [18]:
s.addPoints(('I 20 2.5', 'J 30 2.5', 'K 25 8'), overwrite = True)

In [21]:
s.replot()
s.plot('A B C D', 'ABCD')
s.plot('AB BC CD DA', 'ABCD')
s.plot('E F G H', 'EFGH')
s.plot('EF FG GH HE')
s.plot('I J K', 'IJK')
s.plot('IJ JK KI')

Shape Name: A
Shape Name: B
Shape Name: C
Shape Name: D
Shape Name: AB
Segment2D AB:
Segment2D(Point2D(0, 0), Point2D(10, 0))

Shape Name: BC
Segment2D BC:
Segment2D(Point2D(10, 0), Point2D(10, 10))

Shape Name: CD
Segment2D CD:
Segment2D(Point2D(10, 10), Point2D(0, 10))

Shape Name: DA
Segment2D DA:
Segment2D(Point2D(0, 10), Point2D(0, 0))

Shape Name: E
Shape Name: F
Shape Name: G
Shape Name: H
Shape Name: EF
Segment2D EF:
Segment2D(Point2D(12, 0), Point2D(35, 0))

Shape Name: FG
Segment2D FG:
Segment2D(Point2D(35, 0), Point2D(35, 10))

Shape Name: GH
Segment2D GH:
Segment2D(Point2D(35, 10), Point2D(12, 10))

Shape Name: HE
Segment2D HE:
Segment2D(Point2D(12, 10), Point2D(12, 0))

Shape Name: I
Shape Name: J
Shape Name: K
Shape Name: IJ
Segment2D IJ:
Segment2D(Point2D(20, 5/2), Point2D(30, 5/2))

Shape Name: JK
Segment2D JK:
Segment2D(Point2D(30, 5/2), Point2D(25, 8))

Shape Name: KI
Segment2D KI:
Segment2D(Point2D(25, 8), Point2D(20, 5/2))



### Draw circle on top of the rectangle

In [24]:
s.addPoints('L 15 12', overwrite = True)

In [25]:
s.replot()
s.plot('A B C D', 'ABCD')
s.plot('AB BC CD DA', 'ABCD')
s.plot('E F G H', 'EFGH')
s.plot('EF FG GH HE')
s.plot('I J K', 'IJK')
s.plot('IJ JK KI')
s.plot('L', 'L', plotType = 'circle')

Shape Name: A
Shape Name: B
Shape Name: C
Shape Name: D
Shape Name: AB
Segment2D AB:
Segment2D(Point2D(0, 0), Point2D(10, 0))

Shape Name: BC
Segment2D BC:
Segment2D(Point2D(10, 0), Point2D(10, 10))

Shape Name: CD
Segment2D CD:
Segment2D(Point2D(10, 10), Point2D(0, 10))

Shape Name: DA
Segment2D DA:
Segment2D(Point2D(0, 10), Point2D(0, 0))

Shape Name: E
Shape Name: F
Shape Name: G
Shape Name: H
Shape Name: EF
Segment2D EF:
Segment2D(Point2D(12, 0), Point2D(35, 0))

Shape Name: FG
Segment2D FG:
Segment2D(Point2D(35, 0), Point2D(35, 10))

Shape Name: GH
Segment2D GH:
Segment2D(Point2D(35, 10), Point2D(12, 10))

Shape Name: HE
Segment2D HE:
Segment2D(Point2D(12, 10), Point2D(12, 0))

Shape Name: I
Shape Name: J
Shape Name: K
Shape Name: IJ
Segment2D IJ:
Segment2D(Point2D(20, 5/2), Point2D(30, 5/2))

Shape Name: JK
Segment2D JK:
Segment2D(Point2D(30, 5/2), Point2D(25, 8))

Shape Name: KI
Segment2D KI:
Segment2D(Point2D(25, 8), Point2D(20, 5/2))

Shape Name: L

In [31]:
s.replot()
s.plot('A B C D', 'ABCD')
s.plot('AB BC CD DA', 'ABCD')
s.plot('E F G H', 'EFGH')
s.plot('EF FG GH HE')
s.plot('I J K', 'IJK')
s.plot('IJ JK KI')
s.plot('L', 'L', plotType = 'circle', radius = 2)

Shape Name: A
Shape Name: B
Shape Name: C
Shape Name: D
Shape Name: AB
Segment2D AB:
Segment2D(Point2D(0, 0), Point2D(10, 0))

Shape Name: BC
Segment2D BC:
Segment2D(Point2D(10, 0), Point2D(10, 10))

Shape Name: CD
Segment2D CD:
Segment2D(Point2D(10, 10), Point2D(0, 10))

Shape Name: DA
Segment2D DA:
Segment2D(Point2D(0, 10), Point2D(0, 0))

Shape Name: E
Shape Name: F
Shape Name: G
Shape Name: H
Shape Name: EF
Segment2D EF:
Segment2D(Point2D(12, 0), Point2D(35, 0))

Shape Name: FG
Segment2D FG:
Segment2D(Point2D(35, 0), Point2D(35, 10))

Shape Name: GH
Segment2D GH:
Segment2D(Point2D(35, 10), Point2D(12, 10))

Shape Name: HE
Segment2D HE:
Segment2D(Point2D(12, 10), Point2D(12, 0))

Shape Name: I
Shape Name: J
Shape Name: K
Shape Name: IJ
Segment2D IJ:
Segment2D(Point2D(20, 5/2), Point2D(30, 5/2))

Shape Name: JK
Segment2D JK:
Segment2D(Point2D(30, 5/2), Point2D(25, 8))

Shape Name: KI
Segment2D KI:
Segment2D(Point2D(25, 8), Point2D(20, 5/2))

Shape Name: L

In [34]:
s.addPoints('M 18 12', overwrite = True)

In [35]:
s.replot()
s.plot('A B C D', 'ABCD')
s.plot('AB BC CD DA', 'ABCD')
s.plot('E F G H', 'EFGH')
s.plot('EF FG GH HE')
s.plot('I J K', 'IJK')
s.plot('IJ JK KI')
s.plot('L', 'L', plotType = 'circle', radius = 2)
s.plot('M', 'M', plotType = 'circle', radius = 2)

Shape Name: A
Shape Name: B
Shape Name: C
Shape Name: D
Shape Name: AB
Segment2D AB:
Segment2D(Point2D(0, 0), Point2D(10, 0))

Shape Name: BC
Segment2D BC:
Segment2D(Point2D(10, 0), Point2D(10, 10))

Shape Name: CD
Segment2D CD:
Segment2D(Point2D(10, 10), Point2D(0, 10))

Shape Name: DA
Segment2D DA:
Segment2D(Point2D(0, 10), Point2D(0, 0))

Shape Name: E
Shape Name: F
Shape Name: G
Shape Name: H
Shape Name: EF
Segment2D EF:
Segment2D(Point2D(12, 0), Point2D(35, 0))

Shape Name: FG
Segment2D FG:
Segment2D(Point2D(35, 0), Point2D(35, 10))

Shape Name: GH
Segment2D GH:
Segment2D(Point2D(35, 10), Point2D(12, 10))

Shape Name: HE
Segment2D HE:
Segment2D(Point2D(12, 10), Point2D(12, 0))

Shape Name: I
Shape Name: J
Shape Name: K
Shape Name: IJ
Segment2D IJ:
Segment2D(Point2D(20, 5/2), Point2D(30, 5/2))

Shape Name: JK
Segment2D JK:
Segment2D(Point2D(30, 5/2), Point2D(25, 8))

Shape Name: KI
Segment2D KI:
Segment2D(Point2D(25, 8), Point2D(20, 5/2))

Shape Name: L
Shape Name: M