Line Intersection retuns point instead line segment

Hi all,
I want to intersect two lines with the function sdo_intersection (Oracle8i).
However, as result I get always a point instead of a line segment.
Any suggestions ??
Thanks Peter
Following the Script:
/* Table Theme2 */
CREATE TABLE THEME2(ID     NUMBER, GEOM MDSYS.SDO_GEOMETRY);
/* Update Metadata */
INSERT INTO USER_SDO_GEOM_METADATA (TABLE_NAME, COLUMN_NAME, DIMINFO)
VALUES ('THEME2', 'GEOM', MDSYS.SDO_DIM_ARRAY
(MDSYS.SDO_DIM_ELEMENT('X', 2546727.982208079, 2629500.677188804, 0.000000050),
MDSYS.SDO_DIM_ELEMENT('Y', 5479508.594623252, 5585930.631027042, 0.000000050) ) );
COMMIT;
/* Insert 2 Lines */
insert into theme2 values (1,SDO_GEOMETRY(2002, 82015, NULL,
SDO_ELEM_INFO_ARRAY(1, 2, 1),SDO_ORDINATE_ARRAY(
2546727.98, 5570612.31, 2551027.86, 5558787.64, 2554252.77,
5549112.91, 2570914.81, 5536213.27, 2580589.54, 5532988.36,
2612569.9, 5524657.34, 2621438.4, 5512563.92, 2622782.11, 5491870.75, 2629500.68, 5479508.59))
insert into theme2 values (2,mdsys.SDO_GEOMETRY(2002, 82015, NULL,
mdsys.SDO_ELEM_INFO_ARRAY(1, 2, 1), mdsys.SDO_ORDINATE_ARRAY(
2619288.46, 5585930.63, 2613913.61, 5568731.11, 2608538.76, 5550456.62,
2599132.77, 5535675.78, 2597789.06, 5527344.76, 2577095.89, 5517938.77, 2556671.46,
5513638.89, 2547534.21, 5509339.01))
/* Intersect */
select sdo_geom.sdo_intersection(b.geom,a.geom,0.05)
from theme2 a, theme2 b
where a.id=1 and b.id=2;
/* result */
TEST(SDO_GTYPE, SDO_SRID, SDO_POINT(X, Y, Z), SDO_ELEM_INFO, SDO_ORDINATES)
SDO_GEOMETRY(2001, NULL, NULL, SDO_ELEM_INFO_ARRAY(1, 1, 1), SDO_ORDINATE_ARRAY(2597969.08, 5528460.91))

The two lines you've provided intersect at a single point, which is by definition not a line.
If you want to return a line, then the intersection has to happen along some length of the line.
Also, whenever I look at geometries posted I always run sdo_geom.validate_geometry on the
data.
Your user_sdo_geom_metadata should include the srid value stored in the geometries.
The bounds of your user_sdo_geom_metadata should be a bit larger to encompass
both geometries.
Regards,
Dan

Similar Messages

  • Line Segment Intersection Checker

    Hello all,
    I am attempting to design a program that will take a set of n line segments and check which pairs of lines intersect. The lines are finite line segments, and they each have two end-points. I am supposed to be able to store a good amount of "Line Segments" into a data structure (Array, LinkedList, BinarySearchTree), etc. I am then supposed to be able to test each line segment against all of the other line segments that are read in in a text file in the format L1: (x,y),(x,y)
    I figured out how to test whether or not two finite line segments intersect, that is not the problem. What I am concerned with is the method(s) I can use to read in all of the line segments and then output the intersecting pairs of line segments in the form (L1,L2) means Line segment 1 and Line segment 2 intersect.
    I was thinking that reading the text file, I could just create an array with n slots that holds Line Segment objects (assuming I have created a Point class for keeping track of end-points), start with the first line segment in the array, and use the points from the first line segment's endpoints to all of the other line segment's endpoints in the array and check to see if they do intersect. Has anybody ever had to do something like this, and if so, what approach did you take to complete?
    Thanks in advance.

    Donojuana wrote:
    ... What I am concerned with is the method(s) I can use to read in all of the line segments and then output the intersecting pairs of line segments in the form (L1,L2) means Line segment 1 and Line segment 2 intersect.
    I was thinking that reading the text file, I could just create an array with n slots that holds Line Segment objects (assuming I have created a Point class for keeping track of end-points), start with the first line segment in the array, and use the points from the first line segment's endpoints to all of the other line segment's endpoints in the array and check to see if they do intersect.
    ...That sounds like a good plan.

  • Anchor points on line segments.....

    Closed path made with pen tool in Flash MX  comprises of line segments & curved segments both.While adding anchor points on segments it is noticed
    that pen tool adds anchor points on curvaceous segments but not on line segments. Why is it so ? Is their any way to accomlish this task ?

    If you hover over the pen tool in its toolbar you should get a selection of different pen tools, at least one of which will allow you to add an anchor point on a straight line.

  • Obtain offset of a point from a line segment

    Hi,
    Given a line segment and a point perpendicular to the line segment(both in LRS). Is it possible to retrieve the offset of the point from the line segment. i've serached the LRS documentation and have not found a built in function to do so.

    If I understand you correctly, the following thread should answer that: If not, please explain further.
    lrs offset
    Bryan

  • Drag and dynamically add line segments?

    Dear all:
    I draw a continuous line segments by mouse, which starts by a left
    mouse click. Then if user click on another location on the screen, it
    will continuously add a line segment to the screen. This process ends
    with a right mouse click. In this case, all the points are shown
    in a JPanel and stored in a Vector.
    My question is:
    after the line is shown on the screen, how can I use mouse to drag
    any points on these line segments (it does not necessary need to be
    the line-segment connecting points), such that the new points will be
    added to the line, and original line segments' shape changed
    accordingly during the mouse drag.
    Example:
    Step 1: A line (containing line segments], which is drawn by mouse on the Panel:
        * [left click]
          *  [left click]
          |
          |
          *  [left click]
           * [right click]
    Step 2: Drag any points in the line, this does not necessary to be
    original points that define the line-segments, such as the + in the
    following.
          |
          + [here left click a point on the line]
          |
    Step 3: If I drag the + in above figure to left, it will become:
        +  [right click, the new point and new line segment is added]
    When the mouse released, the new shape is shown on the panel.How to do the dynamically drag?
    Thanks in advance!

    Try this
    regards
    Stas
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.geom.*;
    import java.util.ArrayList;
    public class Test {
        JScrollPane scroll;
        JPanel p=new JPanel(new BorderLayout());
        Robot robot=new Robot();
        public Test()  throws Exception {
            final JFrame frame=new JFrame();
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.getContentPane().add(p);
            frame.getContentPane().add(new Desktop());
            frame.setBounds(0,0,350,350);
            frame.show();
        public static void main(String[] args) throws Exception {
            new Test();
    class Desktop extends JPanel implements MouseListener, MouseMotionListener{
        ArrayList polyline=new ArrayList();
        Point startPoint;
        boolean dragged=false;
        int lineIndex=-1;
        public Desktop() {
            super();
            addMouseListener(this);
            addMouseMotionListener(this);
            polyline.add(new Line2D.Double(10,10,150,150));
            polyline.add(new Line2D.Double(150,150,10,300));
        public void mouseDragged(MouseEvent e) {
        public void mouseMoved(MouseEvent e) {
        public void mouseClicked(MouseEvent e) {
        public void mousePressed(MouseEvent e) {
            Point point=e.getPoint();
            Rectangle2D pointRect=new Rectangle(point.x-3,point.y-3,7,7);
            for (int i=0; i<polyline.size(); i++) {
                Line2D line=(Line2D)polyline.get(i);
                if (line.intersects(pointRect)) {
                    startPoint=point;
                    lineIndex=i;
                    return;
            lineIndex=-1;
        public void mouseReleased(MouseEvent e) {
            if (lineIndex>=0) {
                Point2D endPoint=e.getPoint();
                Line2D line=(Line2D)polyline.get(lineIndex);
                Line2D firstPart=new Line2D.Double(line.getP1(),endPoint);
                Line2D secondPart=new Line2D.Double(endPoint,line.getP2());
                polyline.remove(lineIndex);
                polyline.add(secondPart);
                polyline.add(firstPart);
                this.repaint();
        public void mouseEntered(MouseEvent e) {
        public void mouseExited(MouseEvent e) {
        public void paint(Graphics g) {
            super.paint(g);
            g.setColor(Color.red);
            for (int i=0; i<polyline.size(); i++) {
                Line2D line=(Line2D)polyline.get(i);
                ((Graphics2D)g).draw(line);

  • Gap between line segments

    How do I set two line segments apart (at suppose 12%) of it's length no matter how large or small i resize the two line segments, sort of like the settings in ChemBioDraw 13.0 for anyone who have used this software ? For anyone with experience in ChemBioDraw 13.0 you can look into the draw settings and it will say how far apart the two lines in the double bond is, line width etc..etc.. Any ideas ? Thanks !

    ghostanime,
    When you use Effect>Distort & Transform>Transform>Move a copy, you still have just one line with a copy line at a certain horizontal distance from it, and that line will disappear if you click Reduce to Basic Appearance in ther Appearance palette/panel, and misbehave if you rotate; also, the original line will be what you are moving.
    When you Object>Expand Appearance, you will have two independent lines/objects instead.
    You may select and Group ((Ctrl/Cmd+G) whatever you wish to reuse, then copy and reuse as a unit, or even turn it into a Symbol.
    With the suggestion of using an Art Brush, you actually create such a unit for the double bond itself; I suggested that because you mentioned the wish to keep the proportions. You could also create the two lines as desired and group them; you should be aware that If you wish to change the size, you will have to tick Scale Strokes & Effects if you wish to keep all the proportions.
    Groups can form part of groups, so you can assemble building blocks (such as double bonds) into more complex bonds (such as molecules).
    Made as an Art Brush or as a Group, when you select the double bond, you will operate it by the centre between the two lines (presuming you have the Centre Reference Point selected in the Transform palette/Panel), with the effect you will operate it by the centre of the original path, which will be off.

  • Joining Line Segments

    The line looks like it's connected, but it's not. When I apply the brush effect it becomes disjointed. I want it to be one smooth stroke. Is there any way to join the line segments without having to redraw the stroke? I ask this because the line was imported into Illustrator from Flash, there are many more and I don't want to have to redraw them all. Thanks in advance for any help.

    Bob,
    Hopefully, you can:
    1. Deselect the path and then drag across each set of Anchor Points where the brushes go thin;
    2. Object>Path>Join.
    If you select the lot before 1+2, and look in the Layers palette, or open Window>Document Info, and select Objects in the flyout menu, you should be able to see that there are multiple paths; the latter shows the number of points in each selected object.
    If 1 + 2 do (or should it be does) not work, there are probably multiple Anchor Points at the end(s) of either/both of the paths to be joined; the surplus should be deleted.
    Or the paths may be grouped, and should be ungrouped first; that may also be seen in the Layers palette/Document info.

  • Joining Line Segments in CS6

    I am drawing a simple diamond shape made with one rectanlge shape and multiple line segments.  As I drew the design, I made sure to connect all the segments at the anchors.  When I select all of the segments and try to join the paths, the end points or corners are not smooth.  In other words, some of the line segment ends hang over the edges...  What am I doing wrong?  Thanks!
    The image below shows the left side of the diamond, where the top portion meets the bottom...

    Thank you, DayForce.  Changing the corner type to "round join" did the trick!  May I ask another question?  When I select all the segments and join the paths, I get an additional line segment from one point to another.  How can I elminiate this?

  • 3d graph line segment

    Hi:
    I'm trying to find a way to draw a series of x,y,z points to a 3d graph with each point linked to the last with a line segment.  I have been successfull in plotting a series of points to the 3d graph indicator in LabView but I cannot figure out how to connect them with line segments ... does anyone know how this might be done?  Thanks in advance for any help.

    When the cwlinepoint property is activated the graph draws a line from each point to each point which is not what I'm trying to do ... the code I have written is extremely basic ... three 1d arrays each containing number set (one array with x coordinates, one array with y coords, ect.) these are then passed to the CWGraph3D invoke node ... then the points are plotted to the 3d graph as just points ... which is somewhat usable for what I am trying to do but I was surprised to find out that such a functionality was not already built in to LabView.  I thought that there would have been a relatively easy way to do it but I have not been able to find it on my own, so I thought I would put it out there and see if others had already figured it out.  My search of the forum yeilded nothing.  Again your help is greatly appreciated unclebump!!!  Find attached code.  Was written in Labview 7.1 but should be usable in 7.0 I think. 
    Attachments:
    3dgraphof point attempt.vi ‏35 KB

  • Bisecting a line segment with smart guides?

    Is it possible to use smart guides to place an anchor point exactly in the middle of a line segment?

    Assuming the segment is straight, Object>Path>AddAnchorPoints will add an anchorPoint at the center of the segment.
    JET

  • Joining Multiple Line Segments

    Is there a way to join any number of line segments into one continuous line?
    The end points overlap, but selecting all and going to Object>Path>Join seems to have no effect.
    Making a compound path helps, but doesn't allow me to smooth the final path.

    Joins multiple paths at nearest endpoints while respecting existing outboard handles:
    Joins multiple paths at nearest endpoints while retracting existing outboard handles:
    The scripts are described on and downloadable from
    this page.
    JET

  • How to make line segments persist

    I am studying by myself, and I have already Googled the subject line, to no avail.
    I am trying to write lines with movement dictated by the arrow keys. I can get a line segment to move, but after the movement the whole panel gets repainted. So I don't get any lines written anywhere.
    Anyone have a solution to this?
    Here's my code.
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class DrawLinesUsingKeys extends JFrame {
        private DisplayCoordinatePanelSEVEN keyboardPanel =
                new DisplayCoordinatePanelSEVEN();
        public DrawLinesUsingKeys() {
            getContentPane().add(keyboardPanel);
            keyboardPanel.setFocusable(true);
        /**Main method*/
        public static void main(String[] args) {
            // Create a frame
            DrawLinesUsingKeys frame = new DrawLinesUsingKeys();
            frame.setTitle("Draw Lines Using Keys");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setSize(300, 300);
            frame.setLocationRelativeTo(null);
            frame.setVisible(true);
    class DisplayCoordinatePanelSEVEN extends JPanel implements KeyListener {
        private boolean pressedAction = false;
        private int x = 150;
        private int y = 150;
        private int z = 150;
        private int a = 150;
        public DisplayCoordinatePanelSEVEN() {
            addKeyListener(this);
        public void keyPressed(KeyEvent e) {
            pressedAction = true;
            switch (e.getKeyCode()) {
                case KeyEvent.VK_DOWN:
                    a = y + 10;
                    break;
                case KeyEvent.VK_UP:
                    a = y - 10;
                    break;
                case KeyEvent.VK_LEFT:
                    z = x - 10;
                    break;
                case KeyEvent.VK_RIGHT:
                    z = x + 10;
            repaint();
        public void keyReleased(KeyEvent e) {
        public void keyTyped(KeyEvent e) {
        public void paintComponent(Graphics g) {
            super.paintComponent(g);
            g.setColor(Color.BLACK);
            if (pressedAction) {
                g.drawLine(x, y, z, a);
                pressedAction = false;
                x = z;
                y = a;
        }Thank you for your time.

    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    class DrawLinesUsingKeys extends JFrame {
        private DisplayCoordinatePanelSEVEN keyboardPanel =
                new DisplayCoordinatePanelSEVEN();
        public DrawLinesUsingKeys() {
            getContentPane().add(keyboardPanel);
            keyboardPanel.setFocusable(true);
        public static void main(String[] args) {
            DrawLinesUsingKeys frame = new DrawLinesUsingKeys();
            frame.setTitle("Draw Lines Using Keys");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setSize(300, 300);
            frame.setLocationRelativeTo(null);
            frame.setVisible(true);
    class DisplayCoordinatePanelSEVEN extends JPanel implements KeyListener {
        java.util.List<Point> points = new java.util.ArrayList<Point>();
        private boolean pressedAction = false;
        private int x = 150;
        private int y = 150;
        private int z = 150;
        private int a = 150;
        public DisplayCoordinatePanelSEVEN() {
            addKeyListener(this);
            points.add(new Point(x,y));
        public void keyPressed(KeyEvent e) {
            pressedAction = true;
            switch (e.getKeyCode()) {
                case KeyEvent.VK_DOWN:
                    //a = y + 10;
                    y += 10;
                    points.add(new Point(x,y));
                    break;
                case KeyEvent.VK_UP:
                    //a = y - 10;
                    y -= 10;
                    points.add(new Point(x,y));
                    break;
                case KeyEvent.VK_LEFT:
                    //z = x - 10;
                    x -= 10;
                    points.add(new Point(x,y));
                    break;
                case KeyEvent.VK_RIGHT:
                    //z = x + 10;
                    x += 10;
                    points.add(new Point(x,y));
            repaint();
        public void keyReleased(KeyEvent e) {
        public void keyTyped(KeyEvent e) {
        public void paintComponent(Graphics g) {
            super.paintComponent(g);
            g.setColor(Color.BLACK);
            if (pressedAction) {
                for(int xx = 0, yy = points.size()-1; xx < yy; xx++)
                  Point p1 = points.get(xx);
                  Point p2 = points.get(xx+1);
                  g.drawLine(p1.x, p1.y, p2.x, p2.y);
                pressedAction = false;
                //x = z;
                //y = a;
    }

  • Fillable object from line segments

    I've created a tree object from line segments and it looks how I want it to look. I made it a compound path. When I fill it, I get weird results. I used live fill and that works fine, but I still dont get the pointed edges that I would like to see on the outline and I feel like there is a more elegant way to go about this. I have attached the image of the tree. The blue circle is the weird fill. The red circle is the pointed edges that I want. I got this point using the pen tool, but it doesn't act correctly with the rest of the path.
    I am probably doing this all completely wrong,  but I'm a bit impatient for classes and I learn best through trial and  error.

    Select your object and in your stroke panel increase the miter limit to a higher number
    The weird gren or blue fill is probably because your points are not joined. Use the hollow arrow tool to select a point and move it you will see. You can fix by using the hollow arrow tool to select only the 2 points, then using object >> path >> join

  • One dimensional line segments

    Hi,
    I 'm facing the problem of indexing temporal intervals
    and performing interval intersection queries. I 've seen
    timestamp and interval data types but no information
    about the existence of a temporal indexing scheme or
    interval query operators, but only interval arithmetic operators. I 'am thinking of using a 2d line segment spatial index
    with the extend of the second dimension set to zero, something like
    MDSYS.SDO_DIM_ELEMENT('T1', 0, 100, 1), -- 1st d
    MDSYS.SDO_DIM_ELEMENT('T2', 0, 0, 0) -- 2nd d
    time is in seconds.
    I was wondering if anyone has dealt with such problem
    before and would like to share his experience.
    Thanks,
    Sotiris

    In Snow Leopard I had lots of spaces and they were organized in a rectangular grid, as I'm sure you remember.  It was easy to use numbers to get to the ones on the first row or two, but after that I usually navigated the grid with the arrow keys.  The up/down arrows let me quickly move between rows and I would organize related apps so they might be not just adjacent to each other horizontally, but also vertically.  When in Safari, the left arrow would take me in one step to Mail, the right arrow in one step to iTunes, and the down arrow in one step to Quicken.  So apps that I used a lot were just one keystroke away.  It was convenient to be able to jump in one keystroke from space 1 to space 5 (down arrow), which was possible because the spaces were organized in a grid. 

  • Densify straight line segments

    Hello All,
    I'm looking for a way to densify (add vertices at a specified interval) along a straight line segment. SDO_ARC_DENSIFY doesn't work as I need on straight line segments. Can anyone suggest a way to do this?
    I considered writing my own function as the logic seems simple, but I don't see a function to measure distances along a line w/o converting to LRS.
    Thanks!
    --john                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    Hi John,
    So what's the aversion to LRS? Licensing? The Oracle Spatial guide pretty much steps you through what you want to do here using LRS
    http://download.oracle.com/docs/cd/E11882_01/appdev.112/e11830/sdo_lrs_ref.htm#autoId1
    They take a linestring, snap it into two pieces at measure 5 and then stick the pieces back together with the new point at the break. Just wrap up a CONVERT_TO_LRS_GEOM and CONVERT_TO_STD_GEOM on the way in and on the way out of your function. I assume you already know from what end you want to measure and that your linestrings run that way consistently.
    If you don't have the Spatial license then it's a bit more complicated. You need to walk the coordinates in the linestring adding up the distance and then figure out where your break point would land on the segment when you hit the desired measure. That's a fairly tall order for a forum request but perhaps other folks have some ideas for you. I would just use the LRS stuff myself so I've never thought through what it would take.
    Cheers,
    Paul

Maybe you are looking for

  • Can you watch movie off your iPad 1 on your tv using hdmi

    Trying to watch my movies and utube on my tv using hdmi adapter I've been to iPad1 you can't do this is this correct

  • Is it possible to place display co-ordinate for page item

    hi, In any one of the reagion, if i want to display the label as "Name" in Row Number 15, column no 10 (assuming screen size is 25 rows and 80 characters ) and input column on specified row and column. (here row is vertically numbered and column is h

  • Connecting to MS SQL server 2000 with SSMS 2008

    Hello I have been trying to solve this problem for months now and searched lots of threads, but no success. Our office has sql server 2000 database, which is installed on Windows XP. I am given 'sa' password. On my computer, which is Windows 7, I hav

  • Nano 4th Genoration doesnt apper in My Computer or iTunes- still charges

    My iPod 8gb 4th Genoration Nano wont sync. It doesnt appeer in My Computer and iTunes but it still charges. When it works, it says 'iPod cant sync' or if i try and restore it it says 'iPod cant restore'. Some times it says 'This USB device is not rec

  • Block alv .

    Hello masters, I m using block alv to display 5 tables one below other , i have used the fm REUSE_ALV_BLOCK_LIST_INIT , REUSE_ALV_BLOCK_LIST_APPEND , REUSE_ALV_BLOCK_LIST_DISPLAY my problem is only the last table is displayed .