Back to index

wims  3.65+svn20090927
LineIntersectionObject.java
Go to the documentation of this file.
00001 package rene.zirkel.objects;
00002 
00003 import rene.zirkel.construction.Construction;
00004 import rene.zirkel.structures.Coordinates;
00005 
00006 // file: IntersectionObject.java
00007 
00008 
00009 public class LineIntersectionObject extends IntersectionObject
00010 {      public LineIntersectionObject (Construction c, 
00011               PrimitiveLineObject P1, PrimitiveLineObject P2)
00012        {      super(c,P1,P2);
00013               validate();
00014        }
00015        
00016        public void updateCircleDep ()
00017        {      ((PrimitiveLineObject)P1).addDep(this);
00018               ((PrimitiveLineObject)P2).addDep(this);
00019        }
00020 
00021        public void validate ()
00022        {      if (!P1.valid() || !P2.valid()) Valid=false;
00023               else Valid=true; 
00024               if (!Valid) return;
00025               Coordinates c=
00026                      PrimitiveLineObject.intersect((PrimitiveLineObject)P1,
00027                                    (PrimitiveLineObject)P2);
00028               if (c==null) { Valid=false; return; }
00029               X=c.X; Y=c.Y;
00030               if (Restricted)
00031               {      if (!((PrimitiveLineObject)P1).contains(X,Y)) Valid=false;
00032                      else if (!((PrimitiveLineObject)P2).contains(X,Y)) Valid=false;
00033               }
00034        }
00035 }