1
$\begingroup$

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

$\endgroup$
8
13
$\begingroup$

How about discretizing the letter's boundary?

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

stringBoundary["D"]

enter image description here

$\endgroup$
2
$\begingroup$

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

$\endgroup$
1
  • $\begingroup$ To get the points on the D shape, just use MeshCoordinates. $\endgroup$ – flinty Sep 24 '20 at 14:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.