/*			if (this.borders[iBorder].getNormal().dotProduct(sectLine.direction)==0)
 *                              continue; // line is within the plane, does not intersect. Continue for iLimitBorder loop
 *                      Scientrace.Location node = this.borders[iBorder].lineThroughPlane(sectLine);
 *                      double nodeDistance = sectLine.startingpoint.distanceTo(node);
 *                      // slice location found before start of the line
 *                      if (nodeDistance < 0)
 *                              continue;
 *                      // slice location found after end of the line
 *                      if (nodeDistance > lpLen)
 *                              continue;
 *                      if (node == null) {
 *                              Console.WriteLine("WARNING, NODE=null: "+this.borders[iBorder].ToString()+" vs. "+sectLine.ToString());
 *                              continue; // somehow the line didn't go through the plane in the end...
 *                              }*/

        public List <ObjectLinePiece> sliceObjectLinePiece(ObjectLinePiece anObjectLinePiece)
        {
            List <ObjectLinePiece> slices = new List <ObjectLinePiece>();

            slices.Add(anObjectLinePiece);     //start with single OLP in list, make the list grow/be rewritten in iteration below
            // Iterate through all borders
            foreach (PlaneBorder aBorder in this.borders)
            {
                slices = this.slice(slices, aBorder);
            }
            return(slices);
        }
Exemple #2
0
        public List <ObjectLinePiece> toOLP(List <LinePiece> aList, string colour, Object3d anO3D)
        {
            List <ObjectLinePiece> olplist = new List <ObjectLinePiece>();

            foreach (LinePiece anLP in aList)
            {
                ObjectLinePiece anOLP = new ObjectLinePiece();
                anOLP.o3d = anO3D;
                anOLP.lp  = anLP;
                anOLP.col = colour;
                olplist.Add(anOLP);
            }
            return(olplist);
        }
Exemple #3
0
        static public string drawLinePiecesXML(List <LinePiece> linePieces, string colour)
        {
            List <ObjectLinePiece> olps = new List <ObjectLinePiece>();

            foreach (LinePiece lp in linePieces)
            {
                ObjectLinePiece tolp = new ObjectLinePiece();
                tolp.col = colour;
                tolp.lp  = lp;
                olps.Add(tolp);
            }
            return(LinePiece.drawLinePiecesXML(olps));

            /*System.Text.StringBuilder retstr = new System.Text.StringBuilder(5000);
             * foreach (LinePiece lp in linePieces) {
             *      retstr.Append(X3DGridPoint.get_RGBA_Line_XML(lp, colour));
             *      }
             * return retstr.ToString(); */
        }
Exemple #4
0
	/// <summary>
	/// From a list of LinePieces, find out for each linepiece whether they are inside all other volumes or not.
	/// The reason for this method is that the "inner borders" don't have to be drawn, only the outer borders, those
	/// not enclosed by the other subvolumes borders.
	/// </summary>
	/// <returns>The inside outside OL ps.</returns>
	/// <param name="olps">Olps.</param>
	public List<ObjectLinePiece> markInsideOutsideOLPs(List<ObjectLinePiece> olps) {
		List<ObjectLinePiece> markedOLPs = new List<ObjectLinePiece>();
		foreach (ObjectLinePiece anOLP in olps) {
			ObjectLinePiece tOLP = anOLP;
			//tOLP.col = this.getMarkCol();
			//Console.Write("+");
			foreach (PlaneBorderEnclosedVolume aSubVolume in this.subVolumes) {
				// do not use the subvolume that created the border for container-checking
				if (tOLP.o3d == aSubVolume) { 
					continue;
					} 
				// Replaced "0.0000001" below with MainClass.SIGNIFICANTLY_SMALL. Not sure though if exception was made on purpose. Restore, or replace with Math.Sqrt(MainClass.SIGNIFICANTLY_SMALL) in case of errors. jbos@20160307
				if (aSubVolume.contains(tOLP.lp.getCenter(), null, MainClass.SIGNIFICANTLY_SMALL)) {
					tOLP.col = "0 0 0 0.1";
					}
				}
				// Distances/linepieces smaller than "significance" are considered insignificant and are ignored.
				if(tOLP.lp.getLength() > MainClass.SIGNIFICANTLY_SMALL)
					markedOLPs.Add(tOLP);
			}
		return markedOLPs;
		}
Exemple #5
0
 public List<ObjectLinePiece> toOLP(List<LinePiece> aList, string colour, Object3d anO3D)
 {
     List<ObjectLinePiece> olplist = new List<ObjectLinePiece>();
     foreach (LinePiece anLP in aList) {
     ObjectLinePiece anOLP = new ObjectLinePiece();
     anOLP.o3d = anO3D;
     anOLP.lp = anLP;
     anOLP.col = colour;
     olplist.Add(anOLP);
     }
     return olplist;
 }
Exemple #6
0
 public static string drawLinePiecesXML(List<LinePiece> linePieces, string colour)
 {
     List<ObjectLinePiece> olps = new List<ObjectLinePiece>();
     foreach (LinePiece lp in linePieces) {
     ObjectLinePiece tolp = new ObjectLinePiece();
     tolp.col = colour;
     tolp.lp = lp;
     olps.Add(tolp);
     }
     return LinePiece.drawLinePiecesXML(olps);
     /*System.Text.StringBuilder retstr = new System.Text.StringBuilder(5000);
     foreach (LinePiece lp in linePieces) {
     retstr.Append(X3DGridPoint.get_RGBA_Line_XML(lp, colour));
     }
     return retstr.ToString(); */
 }