2

I was wondering how I can graphically plot an alphabetic character, for example D, in 2 dimension, using mathematica? I was using ListPlot with specific x and y values but it's not looking anything like a D...

Help would be appriciated! :)

This is my current D:

enter image description here

Vetenskap
  • 199
  • 1
  • 4

2 Answers2

13

How about discretizing the letter's boundary?

stringBoundary[char_String] := 
  RegionBoundary[DiscretizeGraphics[First@ImportString[ExportString[char, "PDF"]]]]

stringBoundary["D"]

enter image description here

Greg Hurst
  • 35,921
  • 1
  • 90
  • 136
2

This is also possible in v11.0+ with ImageMesh and Rasterize. The RasterSize ends up affecting mesh quality here:

RegionBoundary@ImageMesh@ColorNegate@Rasterize["любо",RasterSize->400]

text boundary

You could also just get the edge by using a FillingTransform to ignore the interior of shapes:

RegionBoundary@ImageMesh@FillingTransform@ColorNegate@Rasterize["D", RasterSize -> 400]

hole plugged mesh

flinty
  • 25,147
  • 2
  • 20
  • 86