[Vennerable-commits] r46 - in pkg/Vennerable: R inst/doc tests

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Aug 6 19:03:05 CEST 2009


Author: js229
Date: 2009-08-06 19:02:52 +0200 (Thu, 06 Aug 2009)
New Revision: 46

Added:
   pkg/Vennerable/tests/bug0522CR0100.R
Modified:
   pkg/Vennerable/R/02TissueDrawing.R
   pkg/Vennerable/R/03VennDrawing.R
   pkg/Vennerable/inst/doc/TissueDrawingTest.Rnw
   pkg/Vennerable/inst/doc/Venn.Rnw
   pkg/Vennerable/inst/doc/VennDrawingTest.Rnw
Log:
Fix bug 522 on finding internal points in a complicated face

Modified: pkg/Vennerable/R/02TissueDrawing.R
===================================================================
--- pkg/Vennerable/R/02TissueDrawing.R	2009-08-06 15:57:36 UTC (rev 45)
+++ pkg/Vennerable/R/02TissueDrawing.R	2009-08-06 17:02:52 UTC (rev 46)
@@ -1036,6 +1036,12 @@
 	point
 }
 
+.face.maxradius <- function(drawing,faceName) {
+	edgebb <- lapply(.face.to.faceEdges(drawing,faceName),function(x)x at bb)
+	absbb <- max(sapply(edgebb,function(x)max(abs(x))))
+	maxradius <- sqrt(2)*absbb
+	maxradius 
+}
 
 
 .find.point.within.face <- function(drawing,faceName,treat.dark.matter.as.face=FALSE) {
@@ -1055,8 +1061,8 @@
 	# create a line from the centroid to past that point, and call it a chord
 	chord.from.xy <- faceCentroid 
 	grad <- faceCentroid-amidpoint; grad <- grad/sqrt(sum(grad^2))
-	chord.to.xy <- amidpoint- 2*grad
-	
+	maxradius <- .face.maxradius(drawing,faceName)
+	chord.to.xy <- amidpoint- maxradius*grad
 
 	npoints <- .probe.chord.intersections(drawing,faceName,chord.from.xy,chord.to.xy)
 
@@ -1663,6 +1669,8 @@
 	# then arrange all of these intersection points in the order they appear in along the line,
 	# including the chord.from.xy point
 
+	
+
 	# names pc and pmid not used
 	chord <- newEdgeLines(from="pc",to="pmid",xy=rbind(chord.from.xy,chord.to.xy))
 

Modified: pkg/Vennerable/R/03VennDrawing.R
===================================================================
--- pkg/Vennerable/R/03VennDrawing.R	2009-08-06 15:57:36 UTC (rev 45)
+++ pkg/Vennerable/R/03VennDrawing.R	2009-08-06 17:02:52 UTC (rev 46)
@@ -163,6 +163,8 @@
 				res<-agp;
 				res$col<- if (res$col==bcols[1]){bcols[2]}else{bcols[1]};
 				res$fill<-res$col;res})
+		} else {
+		gp <- lapply(gp,function(agp){res<-agp;res$col<-"black";res$fill<-res$col;res})
 		}
 	} else {
 		gp <- lapply(gp,function(agp){res<-agp;res$col<-"black";res$fill<-res$col;res})

Modified: pkg/Vennerable/inst/doc/TissueDrawingTest.Rnw
===================================================================
--- pkg/Vennerable/inst/doc/TissueDrawingTest.Rnw	2009-08-06 15:57:36 UTC (rev 45)
+++ pkg/Vennerable/inst/doc/TissueDrawingTest.Rnw	2009-08-06 17:02:52 UTC (rev 46)
@@ -1286,7 +1286,28 @@
 @
 \caption{Injecting points}
  \end{center}\end{figure}
+\section{Chow Ruskey}
+\subsection{Bug 522}
 
+\begin{figure}[H]\begin{center}
+<<plotCR4,echo=FALSE,fig=TRUE>>=
+data(StemCell)
+Vstem <- Venn(StemCell)
+Tstem <- compute.Venn(Vstem)
+grid.newpage()
+pushViewport(plotViewport(c(1,1,1,1)))
+makevp.eqsc(c(-50,50),c(-50,50))
+grid.xaxis();grid.yaxis()
+PlotSetBoundaries(Tstem)
+PlotNodes(Tstem)
+.validateDrawing(Tstem)
+try(IntersectionMidpoints(Tstem))
+
+@
+\caption{Chow-Ruskey weighted 4-set diagram with smudge warnings}
+\end{center}
+\end{figure}
+
 \section{This document}
 
 \begin{tabular}{|l|l|}

Modified: pkg/Vennerable/inst/doc/Venn.Rnw
===================================================================
--- pkg/Vennerable/inst/doc/Venn.Rnw	2009-08-06 15:57:36 UTC (rev 45)
+++ pkg/Vennerable/inst/doc/Venn.Rnw	2009-08-06 17:02:52 UTC (rev 46)
@@ -664,6 +664,21 @@
 \end{center}
 \end{figure}
 
+
+\begin{figure}[H]\begin{center}
+<<plotCR4stem,echo=TRUE,fig=TRUE,cache=TRUE>>=
+Tstem <- compute.Venn(Vstem)
+gp <- VennThemes(Tstem,colourAlgorithm="sequential")
+gps <- gp[["Set"]]; nSets <- length(gps)
+for (ix in 1:nSets) { gps[[ix]]$lwd <- nSets+1 - ix }
+gp[["Set"]] <- gps
+plot(Vstem,type="ChowRuskey",show=list(SetLabels=TRUE),gp=gp)
+@
+\caption{Chow-Ruskey weighted 4-set diagram for the stem cell data}
+\end{center}
+\end{figure}
+
+
 \newpage
 %########################################################
 \section{Euler diagrams}
@@ -799,9 +814,7 @@
 \subsubsection{Circles}
 There is currently no effect of setting \texttt{doEuler=TRUE} for three circles,
 but the \texttt{doWeights=TRUE} flag does an approximate job. There are about
- 40 distinct ways in which intersection regions can have zeroes can occur, and some of these expose 
-bugs in the underlying polygon-polygon clipping code,
-but here are some examples.
+ 40 distinct ways in which intersection regions can have zeroes can occur, but here are some examples.
 
 
 <<otherV,echo=FALSE>>=

Modified: pkg/Vennerable/inst/doc/VennDrawingTest.Rnw
===================================================================
--- pkg/Vennerable/inst/doc/VennDrawingTest.Rnw	2009-08-06 15:57:36 UTC (rev 45)
+++ pkg/Vennerable/inst/doc/VennDrawingTest.Rnw	2009-08-06 17:02:52 UTC (rev 46)
@@ -688,7 +688,6 @@
 \end{center}
 \end{figure}
 
-\subsection{Chow-Ruskey diagrams for 4 sets}
 
 \begin{figure}[H]\begin{center}
 <<>>=

Added: pkg/Vennerable/tests/bug0522CR0100.R
===================================================================
--- pkg/Vennerable/tests/bug0522CR0100.R	                        (rev 0)
+++ pkg/Vennerable/tests/bug0522CR0100.R	2009-08-06 17:02:52 UTC (rev 46)
@@ -0,0 +1,6 @@
+library(Vennerable)
+data(StemCell)
+Vstem <- Venn(StemCell)
+Tstem <- compute.Venn(Vstem)
+.validateDrawing(Tstem)
+IntersectionMidpoints(Tstem)
\ No newline at end of file



More information about the Vennerable-commits mailing list