[osg-users] Finding the edge of a frustum, or intersection with the edge of a frustum

Glenn Waldron gwaldron at gmail.com
Sat Nov 9 05:38:58 PST 2019


Brad,
You take the plane that defines the left side of the view frustum; then you
intersect your line with that plane.

I find this is easiest to do in normalized clip space (which goes from
[-1..1] in each dimension). The left plane will be defined as
point=(-1,0,0), normal=(1,0,0). You can convert your line's points into
clip space by multiplying each point by the (modelview matrix * projection
matrix).

I successfully used this approach for graticule labeling in osgEarth. Good
luck!

Glenn Waldron / osgEarth


On Fri, Nov 8, 2019 at 3:44 PM Brad Colbert <bcolbert at rscusa.com> wrote:

> Hi,
>
> I'm using an ortho frustum to draw a map.  On the map I'm drawing a kind
> of range ring / sector pattern, starting from an origin using lines.  I
> want to draw text at the edge of the viewport where the lines intersect
> with the edge (well, just inside so the text is viewable).
>
> The problem I'm having is I can't quite figure out how to tell where the
> lines end within the frustum.  Any ideas would be welcomed.
>
> Picture for context is attached.
>
> Thank you!
>
> Cheers,
> Brad
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=76886#76886
>
>
>
>
> Attachments:
> http://forum.openscenegraph.org//files/mapview_458.png
>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20191109/01f14cac/attachment.html>


More information about the osg-users mailing list