# Discretizing a (kinked) line and showing how the points were determined

Suppose I have a (kinked) line, for example

2-x==y && x< 1
3-2x == y && 1.5>=x>= 1

I want to take this kinked line and represent discretize it (i.e. I want to display points along this line)

I can do this with discretize region, for example

r=ImplicitRegion[2-x==y && x<1 , {x,y}];
r2=ImplicitRegion[3-2x == y && 1.5>=x>= 1,{x,y}];
DiscretizeRegion[RegionUnion[r,r2]]

This will give me a graphic of the line and some discrete points (I would prefer to not have the line included here, but that's not too important)

• How can I show how these points are being determined?
• How can I control how these points are being determined?

My guess is that there is a mesh function or something similar, and if so I could control how the points are being determined by specifying the mesh, but I could not figure this out.

Alternatively, perhaps it is better to use something like MeshRegion?

An explanation of what I want to do:

I want to take a function ( a kinked line in this case, but the function doesn't really matter).

Then, I want to construct a grid consisting of points generated by the intersection of vertical and horizontal grid lines, spaced at intervals of size $$d$$

Next, I want to find the the intersection of these points and the function, and display only these points, as well as the underlying grid that generated them

• (I'm okay not displaying the grid if it gets in the way of visualization, as long as I can separately generate a graphic that shows the grid that was used. Basically, I want to be able to visualize how the points are selected)

An answer doesn't need to use the method I try above. I'm sure custom code can be written to do this. or maybe a mesh could be used where the mesh cells are point (I don't know enough about meshes to say whether that's a viable approach or not)

Heres a rough solution of mine. Feedback and suggestions are very welcome

*this function makes a grid*)

makegrid[xspace_,yspace_,xrange_,yrange_]:=Flatten[Table[{i,j},{i,0,xrange,xspace},{j,0,yrange,yspace}],1];

(*the intercept is written in such a form below because I want the intercept to be
such that the two lines meet at .7*10 *)

kinkedfunction[x_]:=Module[{botslope=2,topslope=1},\[Piecewise] 3 +topslope*(.7*10)-topslope*x  x<=.7*10
17-botslope*x   x>.7*10

];

discretefunction[xmax_, xspace_, func_] := {#, func[#]} & /@
Range[0, xmax, xspace];

(*This function finds the points that the discretized function and \
the grid have in common *)