3
$\begingroup$

I have the following data points:

bound = {{10.`, 
    0.`}, {9.863613034027223`, -1.6459459028073389`}, \
{9.458172417006347`, -3.2469946920468344`}, {8.794737512064891`, \
-4.759473930370735`}, {7.891405093963936`, -6.142127126896678`}, \
{6.77281571625741`, -7.357239106731316`}, {5.469481581224268`, \
-8.371664782625285`}, {4.016954246529695`, -9.157733266550574`}, \
{2.454854871407991`, -9.694002659393304`}, {0.8257934547233232`, \
-9.965844930066698`}, {-0.8257934547233232`, -9.965844930066698`}, \
{-2.454854871407991`, -9.694002659393304`}, {-4.016954246529695`, \
-9.157733266550574`}, {-5.469481581224268`, -8.371664782625285`}, \
{-6.77281571625741`, -7.357239106731316`}, {-7.891405093963936`, \
-6.142127126896678`}, {-8.794737512064891`, -4.759473930370735`}, \
{-9.458172417006347`, -3.2469946920468344`}, {-9.863613034027223`, \
-1.6459459028073389`}, {-10.`, 0.`}, {-10.`, 
    0.42105263157894735`}, {-10.`, 0.8421052631578947`}, {-10.`, 
    1.263157894736842`}, {-10.`, 1.6842105263157894`}, {-10.`, 
    2.1052631578947367`}, {-10.`, 2.526315789473684`}, {-10.`, 
    2.9473684210526314`}, {-10.`, 3.3684210526315788`}, {-10.`, 
    3.789473684210526`}, {-10.`, 4.2105263157894735`}, {-10.`, 
    4.631578947368421`}, {-10.`, 5.052631578947368`}, {-10.`, 
    5.473684210526316`}, {-10.`, 5.894736842105263`}, {-10.`, 
    6.315789473684211`}, {-10.`, 6.7368421052631575`}, {-10.`, 
    7.157894736842105`}, {-10.`, 7.578947368421052`}, {-10.`, 
    8.`}, {-9.863613034027223`, 
    9.64594590280734`}, {-9.458172417006347`, 
    11.246994692046835`}, {-8.794737512064891`, 
    12.759473930370735`}, {-7.891405093963936`, 
    14.142127126896678`}, {-6.77281571625741`, 
    15.357239106731317`}, {-5.469481581224268`, 
    16.371664782625285`}, {-4.016954246529695`, 
    17.157733266550572`}, {-2.454854871407991`, 
    17.694002659393306`}, {-0.8257934547233232`, 
    17.965844930066698`}, {0.8257934547233232`, 
    17.965844930066698`}, {2.454854871407991`, 
    17.694002659393306`}, {4.016954246529695`, 
    17.157733266550572`}, {5.469481581224268`, 
    16.371664782625285`}, {6.77281571625741`, 
    15.357239106731317`}, {7.891405093963936`, 
    14.142127126896678`}, {8.794737512064891`, 
    12.759473930370735`}, {9.458172417006347`, 
    11.246994692046835`}, {9.863613034027223`, 
    9.64594590280734`}, {10.`, 8.`}, {10.`, 
    7.578947368421052`}, {10.`, 7.157894736842105`}, {10.`, 
    6.7368421052631575`}, {10.`, 6.315789473684211`}, {10.`, 
    5.894736842105263`}, {10.`, 5.473684210526316`}, {10.`, 
    5.052631578947368`}, {10.`, 4.631578947368421`}, {10.`, 
    4.2105263157894735`}, {10.`, 3.789473684210526`}, {10.`, 
    3.3684210526315788`}, {10.`, 2.9473684210526314`}, {10.`, 
    2.526315789473684`}, {10.`, 2.1052631578947367`}, {10.`, 
    1.6842105263157894`}, {10.`, 1.263157894736842`}, {10.`, 
    0.8421052631578947`}, {10.`, 0.42105263157894735`}, {10.`, 0.`}};

and I ListPlot these points as follows.

ListPlot[bound, Joined -> False, AspectRatio -> Automatic]

enter image description here

My question is how to fill random points into the shape established by these points? My goal is to get the following image.

enter image description here

But i need to have a description of the region where random points could be generated.

Thank you.

$\endgroup$
2
  • 1
    $\begingroup$ The "random points" you show in the figure don't look like points as there seems to be some linear clustering going on. Is there a secondary process that occurs after a random point is selected? $\endgroup$
    – JimB
    Jul 19, 2023 at 4:06
  • $\begingroup$ yes, i will plot them $\endgroup$
    – 葉柏樂
    Jul 19, 2023 at 5:30

2 Answers 2

8
$\begingroup$
reg = ConvexHullMesh[bound];
pts = RandomPoint[reg, 500];
Show[
 ListPlot[bound
  , Joined -> False
  , AspectRatio -> Automatic
  , PlotStyle -> {AbsolutePointSize[8], Blue}
  , PlotRangePadding -> Scaled[0.1]
  , Epilog -> {
    Red, AbsolutePointSize[4]
    , Point@pts
    }
  ]
 , Region[Style[reg, Opacity[0.1, Yellow]]]
 ]

enter image description here

$\endgroup$
0
6
$\begingroup$

Since the points are in order,we can only use Polygon@bound.

ListPlot[bound, Joined -> False, AspectRatio -> Automatic, 
 Epilog -> {AbsolutePointSize[4], 
   Point[RandomPoint[Polygon@bound, 500]], Opacity[.2], 
   Polygon@bound}]

enter image description here

$\endgroup$
1
  • $\begingroup$ did i get data point inside the boundary? $\endgroup$
    – 葉柏樂
    Jul 19, 2023 at 5:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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