1 pv.SvgScene.dot = function(scenes) {
  2   var g = this.group(scenes);
  3   for (var i = 0; i < scenes.length; i++) {
  4     var s = scenes[i];
  5 
  6     /* visible */
  7     if (!s.visible) continue;
  8     var fill = pv.color(s.fillStyle), stroke = pv.color(s.strokeStyle);
  9     if (!fill.opacity && !stroke.opacity) continue;
 10 
 11     /* points */
 12     var radius = Math.sqrt(s.size), fillPath = "", strokePath = "";
 13     switch (s.shape) {
 14       case "cross": {
 15         fillPath = "M" + -radius + "," + -radius
 16             + "L" + radius + "," + radius
 17             + "M" + radius + "," + -radius
 18             + "L" + -radius + "," + radius;
 19         break;
 20       }
 21       case "triangle": {
 22         var h = radius, w = radius * 2 / Math.sqrt(3);
 23         fillPath = "M0," + h
 24             + "L" + w +"," + -h
 25             + " " + -w + "," + -h
 26             + "Z";
 27         break;
 28       }
 29       case "diamond": {
 30         radius *= Math.sqrt(2);
 31         fillPath = "M0," + -radius
 32             + "L" + radius + ",0"
 33             + " 0," + radius
 34             + " " + -radius + ",0"
 35             + "Z";
 36         break;
 37       }
 38       case "square": {
 39         fillPath = "M" + -radius + "," + -radius
 40             + "L" + radius + "," + -radius
 41             + " " + radius + "," + radius
 42             + " " + -radius + "," + radius
 43             + "Z";
 44         break;
 45       }
 46       case "tick": {
 47         fillPath = "M0,0L0," + -s.size;
 48         break;
 49       }
 50       default: {
 51         function circle(r) {
 52           return "M0," + r
 53               + "A" + r + "," + r + " 0 1,1 0," + (-r)
 54               + "A" + r + "," + r + " 0 1,1 0," + r
 55               + "Z";
 56         }
 57         if (s.lineWidth / 2 > radius) strokePath = circle(s.lineWidth);
 58         fillPath = circle(radius);
 59         break;
 60       }
 61     }
 62 
 63     /* transform */
 64     var transform = "translate(" + s.left + "," + s.top + ")"
 65         + (s.angle ? " rotate(" + 180 * s.angle / Math.PI + ")" : "");
 66 
 67     /* The normal fill path. */
 68     var path = this.cache(s, "path", "fill");
 69     path.setAttribute("d", fillPath);
 70     path.setAttribute("transform", transform);
 71     path.setAttribute("fill", fill.color);
 72     path.setAttribute("fill-opacity", fill.opacity);
 73     path.setAttribute("cursor", s.cursor);
 74     if (strokePath) {
 75       path.setAttribute("stroke", "none");
 76     } else {
 77       path.setAttribute("stroke", stroke.color);
 78       path.setAttribute("stroke-opacity", stroke.opacity);
 79       path.setAttribute("stroke-width", s.lineWidth);
 80     }
 81     this.listen(path, scenes, i);
 82     g.appendChild(this.title(path, s));
 83 
 84     /* The special-case stroke path. */
 85     if (strokePath) {
 86       path = this.cache(s, "path", "stroke");
 87       path.setAttribute("d", strokePath);
 88       path.setAttribute("transform", transform);
 89       path.setAttribute("fill", stroke.color);
 90       path.setAttribute("fill-opacity", stroke.opacity);
 91       path.setAttribute("cursor", s.cursor);
 92       this.listen(path, scenes, i);
 93       g.appendChild(this.title(path, s));
 94     }
 95   }
 96 };
 97