# Is it possible to generate a set of lines based on a list of points?

**URL:** <https://cl.desmos.com/t/is-it-possible-to-generate-a-set-of-lines-based-on-a-list-of-points/4044>\
**Category:** Questions\
**Created:** [February 9, 2022, 4:01pm UTC](https://cl.desmos.com/t/is-it-possible-to-generate-a-set-of-lines-based-on-a-list-of-points/4044 "2022-02-09T16:01:05Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![FleetFoot](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/fleetfoot/32/3750_2.png) [@FleetFoot](https://cl.desmos.com/u/FleetFoot)\
**Post date:** [February 9, 2022, 4:01pm UTC](https://cl.desmos.com/t/is-it-possible-to-generate-a-set-of-lines-based-on-a-list-of-points/4044/1 "2022-02-09T16:01:05Z")

</div>

Apologies for the formatting, I’m a newbie with Desmos and this is my first post so I’m trying to make the code readable

I want to draw a series of lines from one point, say Q, each to one of a selection of other points in a list. For example

N = 10  
D = [(x,y) for x=[-N…N], y=[-N…N] ]

D is a square grid of points covering -10 to +10 in both x and y.

R = 3.5  
C = D[D.y^2 + Dx^2 \< R^2]

C is a list containing the subset of the grid of dots that lie within a circle of radius R, so far, so good.

P = (2, 1)  
Q = (-3, 4)

Writing:  
P, Q  
draws a line from P to Q.

What I would like is to create a set of multiple lines from P to each element of C by writing:  
P, C

That fails with the message “_Cannot combine a point with a list of points._”

Is there a way to achieve this, and if graphic operations cannot use a list of points, what can be done with such a list?

The aim is to illustrate Newton’s Shell Theorem by drawing force vectors and having them dynamically shown depending on the radius and thickness of the shell.

---

<div class="post-metadata">

**Author:** ![StoyanNYC](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/stoyannyc/32/2967_2.png) [@StoyanNYC](https://cl.desmos.com/u/StoyanNYC)\
**Post date:** [February 9, 2022, 4:52pm UTC](https://cl.desmos.com/t/is-it-possible-to-generate-a-set-of-lines-based-on-a-list-of-points/4044/2 "2022-02-09T16:52:00Z")

</div>

Do you want the screen to show all the points immediately? At the same time? Because you could use an action button to generate lines so students can generate as many lines as they want…

Drawing all possible lines that fit the condition at the same time would sort of look like a filled-in circle.

---

<div class="post-metadata">

**Author:** ![Daniel\_Grubbs](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/daniel_grubbs/32/719_2.png) [@Daniel\_Grubbs](https://cl.desmos.com/u/Daniel_Grubbs)\
**Post date:** [February 9, 2022, 5:07pm UTC](https://cl.desmos.com/t/is-it-possible-to-generate-a-set-of-lines-based-on-a-list-of-points/4044/3 "2022-02-09T17:07:49Z")

</div>

Like this? Using f(x,y) as a difference function without a fraction helps avoid undefined vertical lines. The .x and .y are ways of accessing individual coordinates of a point.

> **[Desmos | Graphing Calculator](https://www.desmos.com/calculator/s2iqv2mgwo)**
>
> Explore math with our beautiful, free online graphing calculator. Graph functions, plot points, visualize algebraic equations, add sliders, animate graphs, and more.

---

<div class="post-metadata">

**Author:** ![FleetFoot](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/fleetfoot/32/3750_2.png) [@FleetFoot](https://cl.desmos.com/u/FleetFoot)\
**Post date:** [February 9, 2022, 6:10pm UTC](https://cl.desmos.com/t/is-it-possible-to-generate-a-set-of-lines-based-on-a-list-of-points/4044/4 "2022-02-09T18:10:56Z")

</div>

Daniel, that is exactly what I needed, thank you. The result is just a beginning and needs a lot of refinement but this is a great starter.

> **[Demo\_Lists\_of\_Dots](https://www.desmos.com/calculator/cx71nsaslw)**
>
> Demo\_Lists\_of\_Dots

Stoyan, I have other projects in mind where having buttons and perhaps a canvas with more than one graph would be very advantageous but the help pages start with adding something to a screen without saying how to create a screen to which things can be added. Clearly I’m missing something very basic but I’m only just learning the syntax as you can see (I only heard of Desmos a couple of weeks ago) so that will be a “learning opportunity” for the future. Any pointers to taking that first step would be appreciated though.

---

<div class="post-metadata">

**Author:** ![StoyanNYC](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/stoyannyc/32/2967_2.png) [@StoyanNYC](https://cl.desmos.com/u/StoyanNYC)\
**Post date:** [February 9, 2022, 6:26pm UTC](https://cl.desmos.com/t/is-it-possible-to-generate-a-set-of-lines-based-on-a-list-of-points/4044/5 "2022-02-09T18:26:45Z")

</div>

Here is an example of a screen with action buttons.

> **[Example of using buttons • Activity Builder by Desmos](https://teacher.desmos.com/activitybuilder/custom/620406e83d543a2db8ab477a)**
>
> by Stoyan Stoyanov

---

<div class="post-metadata">

**Author:** ![FleetFoot](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/fleetfoot/32/3750_2.png) [@FleetFoot](https://cl.desmos.com/u/FleetFoot)\
**Post date:** [February 9, 2022, 8:06pm UTC](https://cl.desmos.com/t/is-it-possible-to-generate-a-set-of-lines-based-on-a-list-of-points/4044/6 "2022-02-09T20:06:54Z")

</div>

Thanks Stoyan, I saved a copy and that took me to the screen where I can now create a new one, just what I needed.

Best regards  
George
