Filtering nearby points in a list using distance-threshold circles
Loading the math board and drawing, please wait…
In collections
intersection: surface-surface, curve-curve
This example demonstrates how to filter “nearby” neighbors from a set of points by applying a distance threshold and visualizing which points are kept or removed. The key math ideas are Euclidean distance, modeling a neighborhood with a circle (center at a query point with a given radius), and set-style selection operations such as deduplication and conditional keeping. Construction in GeoGebra uses Append, Sequence, and Zip to build and pair lists of points, then Unique to remove duplicates. Circle creates the threshold neighborhood around a reference point, while KeepIf and RemoveUndefined implement the distance-condition filtering. Length and Textfield support parameter handling and display (e.g., thresholds like ε). Typical objects include InputBox1/2 for user parameters, textual readouts (text1–text6), and list variables such as lPP and lälPP (and their variants) that store the filtered results. Suitable for secondary education projects on algorithmic geometry, math–CS integration, and early university visualization of distance-based point selection.
GeoGebra Commands & Parameters
Append(C, {(-7.227122352568576, 6.3), (-7.43, 6.12), (-8.4, 7.4), (-7.53, 5.45), (-8.663587255344709, 5.7560425400543656), (7.670062882970545, 9.617954642623875), (16.63748163988375, -3.794521177257613), (1.480940077731411, 6.488422425606599), (3.304980892883012, -0.754002561420931), (-3.576833723657818, 15.671132474717396), (-4.194436781028301, -8.708008440411136), (-11.083561995415032, 5.337562142971605), (7.670062882970545, 9.617954642623875), (13.339976248350501, -10.641861678089121), (-0.003912146532369, 0.003057364501322), (-5.367206613941206, 6.978426222543205), (9.423030478007094, 2.151559322647076), (-4.149501888261364, -5.203310788936281), (13.33997624835086, 10.641861678088436), (-4.149501888261364, -5.203310788936281), (-6.5, 6.6), (14.103627785207602, -3.218885485469269), (-1.481524888897013, -6.490984650735204), (4.151140492734138, 5.205365533953871), (2.650124822430615, 2.11382520338954), (-9.423383705823298, -2.150011730466254), (-3.576833723657818, 15.671132474717396), (-7.67066327274682, -9.618707507590461), (-7.67066327274682, -9.618707507590461), (-14.482304084306326, -6.974310068854369), (-11.310307488728789, 9.019450370318966), (16.637481639884076, 3.794521177257068), (-3.304834344153331, -0.754644633357172), (3.576923096002452, 15.671524040543373), (7.557320220484236, 6.025746592197113), (-10.022315800760783, -12.567586505684634), (-0.000329292006409, -3.389899475872677), (5.996203959520251, 2.887619636098174), (-6.983533852871922, 4.637938034270736), (1.471118941670167, 3.054051018632799), (14.103627785207413, 3.218885485469204), (-12.302788674135952, 0.000000000000103), (-7.4, 61), (-14.1035516291821, -3.219219146817295), (3.576923096002452, 15.671524040543373), (0.004851262974027, 0.001057173468102), (-7.435410285261154, 4.927602414007428), (12.30182572370019, -0.000000000000051), (-7.267404945013875, 4.713250773002275), (4.193006590798404, 8.708697183726047), (-16.63623403438272, -3.799987294107673), (-7.53, 6.05), (-0.000171121035375, -14.466289795346938), (9.423030478006956, -2.151559322646906), (-0.002803344115093, 17.06470563541584), (6.276842082288939, 13.033602493027322), (16.074144845895862, 0.000000000000193), (-0.002803344115093, 17.06470563541584), (4.151140492734323, -5.205365533954343), (-10.022315800760783, -12.567586505684634), (1.480940077731411, 6.488422425606599), (-1.470525577977862, -3.05433676752634), (7.406624013808355, 15.373552192001993), (4.193006590798404, 8.708697183726047), (2.737628026035893, -11.994332076089227), (-7.139952617929733, 4.91601583881796), (14.103627785207413, 3.218885485469204), (-2.737413749405578, -11.993393268831783), (-1.470525577977912, 3.05433676752622), (-12.302788674135952, 0.000000000000103), (6.276842082288856, -13.03360249302747), (-3.304834344153293, 0.754644633357136), (-9.423383705823298, -2.150011730466254), (2.65012482243087, -2.113825203389885), (-2.737413749405578, -11.993393268831783), (-1.481524888897013, -6.490984650735204), (-7.670663272746861, 9.618707507590605), (-8.698346980913112, 7.239124164306228), (0.000793695698577, 9.66554242028682), (11.310094104287712, 9.01971794594481), (4.193006590798501, -8.708697183725626), (-6.276533732837609, 13.033750986296848), (-0.002803344115354, -17.064705635415883), (4.151140492734323, -5.205365533954343), (-7.556330498136631, -6.026987664766406), (-3.304834344153331, -0.754644633357172), (-3.304834344153293, 0.754644633357136), (-9.423383705823237, 2.150011730466243), (0.000793695698577, 9.66554242028682), (12.30182572370019, -0.000000000000051), (-11.083561995415025, -5.337562142971636), (-2.650535442846633, -2.11331030167522), (-7.178513973229819, 5.725638281528233), (-8.721520131292046, 5.217266793744119), (-7.556330498136631, -6.026987664766406), (-8.605654379397372, 5.443205009938739), (14.482665945541832, 6.974484332041084), (-6.276533732837609, 13.033750986296848), (-11.310307488728789, 9.019450370318966), (2.65012482243087, -2.113825203389885), (-5.372999901535939, 6.404890750664555), (11.084429583778933, -5.337979951507175), (10.022065385016155, 12.567272494272537), (-10.02231580076091, 12.567586505684472), (-5.529418666593751, 7.1406382751957524), (-0.002803344115354, -17.064705635415883), (5.996203959520218, -2.887619636098153), (10.022065385016333, -12.56727249427238), (3.304980892883135, 0.754002561420965), (2.737628026035849, 11.994332076089428), (11.310094104287712, 9.01971794594481), (-7.32, 6), (-7.401572562260538, -15.375984842855647), (-10.02231580076091, 12.567586505684472), (-0.000329292006234, 3.389899475872126), (16.637481639884076, 3.794521177257068), (0.000793695698457, -9.665542420286704), (-4.149501888261418, 5.203310788936329), (7.406624013808278, -15.373552192001977), (-1.48152488889687, 6.490984650734765), (-8.58827451661317, 5.593830487401818), (-5.355620038751739, 6.787247731916989), (-11.083561995415025, -5.337562142971636), (-8.825799307997254, 5.912461305112179), (6.657912415501918, -0.000000000000069), (-1.48152488889687, 6.490984650734765), (-0.000171121035503, 14.466289795346976), (-16.636234034382696, 3.79998729410738), (-5.772736745572568, 7.18119128835889), (-6.655284297980534, 0.2), (11.310094104287693, -9.019717945944542), (-7.401572562260836, 15.37598484285544), (-5.998571811588356, -2.888759933555225), (14.482665945541832, 6.974484332041084), (5.996203959520251, 2.887619636098174), (7.670062882970544, -9.617954642624042), (13.33997624835086, 10.641861678088436), (5.996203959520218, -2.887619636098153), (-7.25, 5.93), (-7.48, 6.8), (-7.4, 61), (-11.083561995415032, 5.337562142971605), (0.000793695698457, -9.665542420286704), (14.103627785207602, -3.218885485469269), (-4.194436781028413, 8.70800844041119), (-2.650535442846633, -2.11331030167522), (-14.482304084306225, 6.974310068854532), (16.074144845895862, 0.000000000000193), (6.276842082288856, -13.03360249302747), (-0.000329292006234, 3.389899475872126), (-16.07454648156653, -0.000000000000145), (-14.103551629182197, 3.219219146817304), (-8.530341640665833, 7.354989916200904), (-8, 6.8), (2.737628026035893, -11.994332076089227), (11.084429583778938, 5.337979951507497), (-1.470525577977912, 3.05433676752622), (-0.004829527286543, 0.001152403735828), (-14.1035516291821, -3.219219146817295), (-7.45, 61.3), (-5.662367951715511, 5.416763221814026), (11.084429583778933, -5.337979951507175), (1.480940077731417, -6.488422425606563), (1.471118941670276, -3.054051018632759), (-6.838701663003578, 4.800150086923283), (6.657912415501918, -0.000000000000069), (6.276842082288939, 13.033602493027322), (16.63748163988375, -3.794521177257613), (-7.556330498136652, 6.026987664766561), (-7.35, 5.85), (11.310094104287693, -9.019717945944542), (-0.000171121035503, 14.466289795346976), (11.084429583778938, 5.337979951507497), (-3.576833723657824, -15.671132474717346), (-8.605654379397372, 7.557754982016589), (1.480940077731417, -6.488422425606563), (10.022065385016333, -12.56727249427238), (-7.227122352568576, 6.387338342354329), (-11.310307488728865, -9.019450370318971), (4.151140492734138, 5.205365533953871), (7.670062882970544, -9.617954642624042), (0.004851262973816, -0.001057173468078), (-0.004829527286561, -0.001152403735806), (3.304980892883012, -0.754002561420931), (-6.655284297980534, 0.000000000000006), (-5.680044144056828, 6.497583352180297), (-13.34347196128419, -10.637478192717984), (-16.636234034382696, 3.79998729410738), (7.557320220484236, 6.025746592197113), (-14.482304084306225, 6.974310068854532), (7.406624013808355, 15.373552192001993), (13.339976248350501, -10.641861678089121), (-14.103551629182197, 3.219219146817304), (7.406624013808278, -15.373552192001977), (-4.194436781028301, -8.708008440411136), (-11.310307488728865, -9.019450370318971), (-8.762073144455183, 5.4779647355071415), (-7.58, 6.2), (14.4826659455416, -6.974484332041754), (-5.998571811588356, -2.888759933555225), (-14.482304084306326, -6.974310068854369), (-8.808419445213053, 7.337610053416703), (-13.34347196128419, -10.637478192717984), (-8.860559033565655, 5.727076102080696), (2.650124822430615, 2.11382520338954), (-6.5, 5.8), (2.737628026035849, 11.994332076089428), (-9.423383705823237, 2.150011730466243), (-8.988011360649798, 7.215951013927293), (4.193006590798501, -8.708697183725626), (-2.65053544284646, 2.11331030167519), (-9, 7.5), (1.471118941670167, 3.054051018632799), (9.423030478007094, 2.151559322647076), (-0.003912146532319, -0.003057364501384), (14.4826659455416, -6.974484332041754), (-8.930078484702461, 5.402651996775601), (-7.401572562260538, -15.375984842855647), (-4.194436781028413, 8.70800844041119), (-7.3, 5.9), (-16.07454648156653, -0.000000000000145), (-1.470525577977862, -3.05433676752634), (-7.47, 5.85), (-5.737977020004165, 6.87994033343273), (-2.65053544284646, 2.11331030167519)}) → m1Length(m1) → läm1Sequence(RemoveUndefined[Sequence[If[Distance[m1(k), m1(s)] < ε, (s, k), NaN], k, s + 1, Length[m1]]], s, 1, Length[m1] - 1) → m2aUnique(y(Flatten[m2a])) → m2bbZip(m1(k), k, (1…Length[m1]) \ m2bb) → lPPLength(lPP) → lälPPTextfield(ε) → InputBox1Zip(m1(k), k, m2bb) → lPP'Length(lPP') → lälPP'KeepIf(Distance[A, a] < ε, a, m1) → l1Length(l1) → läl1Circle(m1(2), ε) → cCircle((0, 0), ε) → c1Circle(A, ε) → c2RemoveUndefined(Sequence[If[Distance[A, m1(k)] < ε, k], k, 1, Length[m1]]) → l1_kTextfield(a) → InputBox2
AI Drawing Prompt Reference
Create a coordinate plane showing a list of discrete points. Include two user-controlled inputs: ε as a distance threshold, and a reference point a. Visualize the neighborhood using circles: draw the circle centered at a with radius ε, and also draw circles centered at the origin and at another given point with the same radius ε. Then filter the point set by Euclidean distance: keep the points whose distance to a is less than ε and remove or fade the others, clearly showing the two groups. Display ε and the number of kept points using text readouts.
The prompt above was compiled from the original drawing commands and is for reference only.