# Finding similar point in opposite side

Dear Friends,
In following code example, we create a group (grp) also we consider 2 points (ref_pt1 and ref_pt2). Both points are on face1 and face2 is in opposite side of face1. How can we know line perpendicular to the face1 at ref_pt1 and ref_pt2 pass through face2? It seems raytest cannot help me for it or I don’t know how to use it.

``````grp = Sketchup.active_model.active_entities.add_group
pt0 = [0, 0, 0]
pt1 = [2, 10, 0]
pt2 = [8, 10, 0]
pt3 = [10, 0, 0]
face = grp.entities.add_face pt0, pt1, pt2, pt3
face.pushpull -10
######
ref_pt1 = [1, 0, 5]
ref_pt2 = [5, 0, 5]
face1 = nil
face2 = nil
grp.entities.grep(Sketchup::Face) do |f|
result = f.classify_point(ref_pt1)
face1 = f if result == Sketchup::Face::PointInside
end
face1.material = "Green"
grp.entities.grep(Sketchup::Face) do |f|
face2 = f if f.normal.reverse == face1.normal
end
face2.material = "red"
``````

Read about “virtual” lines in the `Geom` module Overview section.

Then you will use the ref pts as the point to construct a line array, and you will probably use the reverse of the face’s normal vector for the line vector. (But it really does not matter which direction the vector points, as virtual lines are infinite in length in both directions.)

Lastly, you will ask the API what point does the line intersect the second face’s plane.

1 Like

Thank you so much. Following codes works well. result1 = 16 and result2 = 1.

``````line1 = [ref_pt1, face1.normal]
line2 = [ref_pt2, face1.normal]
plane2 = [face2.vertices.position, face2.normal]
point1 = Geom.intersect_line_plane(line1, plane2)
point2 = Geom.intersect_line_plane(line2, plane2)
result1 = face2.classify_point(point1)
result2 = face2.classify_point(point2)
p result1
p result2
``````

Just one more question. Definition of line and plane are exactly same. How we can know which one is line and which one is plane?

1 Like

It is up to you to decide (to know) and use In the right place and in the right manner…

2 Likes

This is a bit easier …

``````plane2 = face2.plane
`````` 1 Like

God bless you…

1 Like