Skip to contents

The strokes are the leaves of the kanjivec stroketree. They consist of a two-column matrix giving a discretized path for the stroke in the unit square \([0,1]^2\) with further attributes.

Usage

get_strokes(kvec, which = 1:kvec$nstrokes, simplify = TRUE)

Arguments

kvec

an object of class kanjivec

which

a numeric vector specifying the numbers of the strokes that are to be returned. Defaults to all strokes.

simplify

logical. Shall only the stroke be returned if which has length 1?

Value

Usually a list of strokes with attributes. Regardless of whether which is ordered or contains duplicates, the returned list will always contain the strokes in their natural order without duplicates. If which has length 1 and simplified = TRUE, the list is avoided, and only the single stroke is returned.

Examples

kanji <- fivebetas[[5]]
get_strokes(kanji, c(3,10))    # the two long vertical strokes in 陣
#> [[1]]
#>            [,1]      [,2]
#>  [1,] 0.1547706 0.8233945
#>  [2,] 0.1555799 0.8225476
#>  [3,] 0.1563384 0.8216777
#>  [4,] 0.1570479 0.8207852
#>  [5,] 0.1577098 0.8198706
#>  [6,] 0.1583259 0.8189344
#>  [7,] 0.1588977 0.8179772
#>  [8,] 0.1594269 0.8169993
#>  [9,] 0.1599151 0.8160014
#> [10,] 0.1603640 0.8149839
#> [11,] 0.1607752 0.8139473
#> [12,] 0.1611502 0.8128921
#> [13,] 0.1614907 0.8118188
#> [14,] 0.1617984 0.8107279
#> [15,] 0.1620748 0.8096199
#> [16,] 0.1623216 0.8084953
#> [17,] 0.1625405 0.8073545
#> [18,] 0.1627330 0.8061982
#> [19,] 0.1629007 0.8050267
#> [20,] 0.1630453 0.8038406
#> [21,] 0.1631685 0.8026404
#> [22,] 0.1632718 0.8014265
#> [23,] 0.1633568 0.8001995
#> [24,] 0.1634252 0.7989599
#> [25,] 0.1634787 0.7977081
#> [26,] 0.1635188 0.7964446
#> [27,] 0.1635471 0.7951701
#> [28,] 0.1635653 0.7938848
#> [29,] 0.1635751 0.7925895
#> [30,] 0.1635780 0.7912844
#> [31,] 0.1635780 0.7912844
#> [32,] 0.1635786 0.7892809
#> [33,] 0.1635805 0.7846608
#> [34,] 0.1635836 0.7775735
#> [35,] 0.1635877 0.7681684
#> [36,] 0.1635929 0.7565949
#> [37,] 0.1635991 0.7430024
#> [38,] 0.1636062 0.7275403
#> [39,] 0.1636141 0.7103582
#> [40,] 0.1636228 0.6916052
#> [41,] 0.1636321 0.6714310
#> [42,] 0.1636422 0.6499849
#> [43,] 0.1636527 0.6274162
#> [44,] 0.1636638 0.6038745
#> [45,] 0.1636753 0.5795091
#> [46,] 0.1636872 0.5544695
#> [47,] 0.1636993 0.5289050
#> [48,] 0.1637117 0.5029650
#> [49,] 0.1637242 0.4767991
#> [50,] 0.1637369 0.4505566
#> [51,] 0.1637495 0.4243869
#> [52,] 0.1637621 0.3984394
#> [53,] 0.1637746 0.3728635
#> [54,] 0.1637869 0.3478087
#> [55,] 0.1637990 0.3234243
#> [56,] 0.1638107 0.2998599
#> [57,] 0.1638221 0.2772647
#> [58,] 0.1638330 0.2557882
#> [59,] 0.1638434 0.2355798
#> [60,] 0.1638532 0.2167890
#> [61,] 0.1638532 0.2167890
#> [62,] 0.1638532 0.2119126
#> [63,] 0.1638532 0.2071559
#> [64,] 0.1638532 0.2025218
#> [65,] 0.1638532 0.1980137
#> [66,] 0.1638532 0.1936345
#> [67,] 0.1638532 0.1893873
#> [68,] 0.1638532 0.1852754
#> [69,] 0.1638532 0.1813018
#> [70,] 0.1638532 0.1774696
#> [71,] 0.1638532 0.1737819
#> [72,] 0.1638532 0.1702419
#> [73,] 0.1638532 0.1668527
#> [74,] 0.1638532 0.1636173
#> [75,] 0.1638532 0.1605390
#> [76,] 0.1638532 0.1576207
#> [77,] 0.1638532 0.1548657
#> [78,] 0.1638532 0.1522770
#> [79,] 0.1638532 0.1498578
#> [80,] 0.1638532 0.1476111
#> [81,] 0.1638532 0.1455401
#> [82,] 0.1638532 0.1436480
#> [83,] 0.1638532 0.1419377
#> [84,] 0.1638532 0.1404125
#> [85,] 0.1638532 0.1390754
#> [86,] 0.1638532 0.1379296
#> [87,] 0.1638532 0.1369781
#> [88,] 0.1638532 0.1362241
#> [89,] 0.1638532 0.1356708
#> [90,] 0.1638532 0.1353211
#> attr(,"id")
#> [1] "kvg:09663-s3"
#> attr(,"type")
#> [1] "㇑"
#> attr(,"d")
#> [1] "M16.87,19.25c0.88,0.88,0.96,2.12,0.96,3.5c0,0.68,0.02,43.62,0.03,62.62c0,5.2,0,8.62,0,8.88"
#> 
#> [[2]]
#>            [,1]       [,2]
#>  [1,] 0.5959633 0.90247706
#>  [2,] 0.5969658 0.90144920
#>  [3,] 0.5979239 0.90041456
#>  [4,] 0.5988381 0.89937162
#>  [5,] 0.5997092 0.89831884
#>  [6,] 0.6005378 0.89725468
#>  [7,] 0.6013247 0.89617761
#>  [8,] 0.6020705 0.89508609
#>  [9,] 0.6027758 0.89397860
#> [10,] 0.6034414 0.89285360
#> [11,] 0.6040679 0.89170954
#> [12,] 0.6046561 0.89054490
#> [13,] 0.6052065 0.88935814
#> [14,] 0.6057199 0.88814773
#> [15,] 0.6061969 0.88691213
#> [16,] 0.6066383 0.88564981
#> [17,] 0.6070446 0.88435923
#> [18,] 0.6074166 0.88303885
#> [19,] 0.6077550 0.88168715
#> [20,] 0.6080604 0.88030259
#> [21,] 0.6083334 0.87888363
#> [22,] 0.6085749 0.87742874
#> [23,] 0.6087854 0.87593639
#> [24,] 0.6089657 0.87440503
#> [25,] 0.6091164 0.87283314
#> [26,] 0.6092381 0.87121918
#> [27,] 0.6093316 0.86956161
#> [28,] 0.6093976 0.86785890
#> [29,] 0.6094367 0.86610952
#> [30,] 0.6094495 0.86431193
#> [31,] 0.6094495 0.86431193
#> [32,] 0.6094515 0.85840836
#> [33,] 0.6094570 0.84877570
#> [34,] 0.6094660 0.83568663
#> [35,] 0.6094781 0.81941384
#> [36,] 0.6094930 0.80023002
#> [37,] 0.6095105 0.77840787
#> [38,] 0.6095303 0.75422006
#> [39,] 0.6095521 0.72793930
#> [40,] 0.6095757 0.69983827
#> [41,] 0.6096008 0.67018967
#> [42,] 0.6096271 0.63926618
#> [43,] 0.6096543 0.60734049
#> [44,] 0.6096822 0.57468530
#> [45,] 0.6097105 0.54157329
#> [46,] 0.6097390 0.50827715
#> [47,] 0.6097673 0.47506958
#> [48,] 0.6097952 0.44222327
#> [49,] 0.6098225 0.41001089
#> [50,] 0.6098488 0.37870516
#> [51,] 0.6098739 0.34857875
#> [52,] 0.6098974 0.31990435
#> [53,] 0.6099193 0.29295466
#> [54,] 0.6099391 0.26800237
#> [55,] 0.6099566 0.24532016
#> [56,] 0.6099715 0.22518073
#> [57,] 0.6099835 0.20785677
#> [58,] 0.6099925 0.19362097
#> [59,] 0.6099981 0.18274601
#> [60,] 0.6100000 0.17550459
#> [61,] 0.6100000 0.17550459
#> [62,] 0.6100000 0.17292205
#> [63,] 0.6100000 0.17016023
#> [64,] 0.6100000 0.16723819
#> [65,] 0.6100000 0.16417498
#> [66,] 0.6100000 0.16098964
#> [67,] 0.6100000 0.15770122
#> [68,] 0.6100000 0.15432878
#> [69,] 0.6100000 0.15089136
#> [70,] 0.6100000 0.14740800
#> [71,] 0.6100000 0.14389777
#> [72,] 0.6100000 0.14037970
#> [73,] 0.6100000 0.13687285
#> [74,] 0.6100000 0.13339627
#> [75,] 0.6100000 0.12996900
#> [76,] 0.6100000 0.12661010
#> [77,] 0.6100000 0.12333861
#> [78,] 0.6100000 0.12017359
#> [79,] 0.6100000 0.11713407
#> [80,] 0.6100000 0.11423912
#> [81,] 0.6100000 0.11150777
#> [82,] 0.6100000 0.10895908
#> [83,] 0.6100000 0.10661211
#> [84,] 0.6100000 0.10448588
#> [85,] 0.6100000 0.10259947
#> [86,] 0.6100000 0.10097191
#> [87,] 0.6100000 0.09962225
#> [88,] 0.6100000 0.09856955
#> [89,] 0.6100000 0.09783284
#> [90,] 0.6100000 0.09743119
#> attr(,"id")
#> [1] "kvg:09663-s10"
#> attr(,"type")
#> [1] "㇑"
#> attr(,"d")
#> [1] "M64.96,10.63c1.08,1.08,1.47,2.24,1.47,4.16c0,4.16,0.06,69.46,0.06,75.08c0,2.62,0,8.27,0,8.51"
#>