canvas实现DBSCAN聚类算法可视化过程代码

代码语言:html

所属分类:其他

代码描述:canvas实现DBSCAN聚类算法可视化过程代码

代码标签: 聚类 算法 可视化 过程

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!doctype html>
<html  lang="en-us">
<head>
	<meta charset="utf-8">


</head>
<body>



<div class="center">
	<article>
		<div class="social">
    
</div>
		<h1 class="title">DBSCAN</h1>
		

		<div class="content"><div>
  <p>A visualization of a <a href="http://en.wikipedia.org/wiki/DBSCAN">DBSCAN algorithm</a>.</p>
<style>
    .post {
        max-width: none;
        width: 640px;
        padding: 0;
    }
</style>
<header>
	<nav id="menu"></nav>
	<div class="clear"></div>
</header>
<p><canvas id="canvas" ></canvas></p>
<script>
    
Math.TAU = Math.PI*2;

function $P(x,y){ return new Point(x,y);}
function Point(x,y){
	this.x = x;
	this.y = y;
}

Point.prototype = {
	toString : function(){ 
		return "<" + this.x.toFixed(2) + ";" + this.y.toFixed(2) + ">"; 
	}
};

function $R(left, top, right, bottom){
	return new Rect(left, top, right, bottom);
}

function Rect(left, top, right, bottom){
	this.left = left;
	this.top = top;
	this.right = right;
	this.bottom = bottom;
}

Rect.prototype = {
	get width(){ return Math.abs(this.right - this.left); },
	get height(){ return Math.abs(this.bottom - this.top); },

	get dx(){ return this.right - this.left.........完整代码请登录后点击上方下载按钮下载查看

网友评论0