【高中数学/立体几何/向量】求底面边长为2高为1的正四棱锥两侧面夹角

【问题】

一个正四棱锥,底面边长为2,高为1,求两侧面PAB与PCD夹角?

【传统方法】

找ab中点e,dc中点f,易知面PEF⊥面PAB,面PEF⊥面Pdc,故∠epf即为所求角,因为po=pe=pf,故▲pef为等腰直角三角形,∠epf=90°.

【向量法】

定点:

P(0,0,1)

A(-1,-1,0)

B(1,-1,0)

D(-1,1,0)

C(1,1,0)

求向量:

PA(-1,-1,-1),  PB(1,-1,-1)

PD(-1,1,-1),  PC(1,1,-1)

设法向量N1⊥面PAB,则

-x-y-z=0

x-y-z=0

求得x=0,y=1,z=-1,故N1(0,1,-1)

设法向量N2⊥面PCD,则

-x+y-z=0

x+y-z=0

求得x=0,y=1,z=1,故N2(0,1,1)

求角:

cos<N1,N2>=|0*0+1*1-1*1|/2=0,故面PAB与PCD的夹角为90°,这与第一种方法得出的结论一致。

【绘制图像的Canvas代码】

<!DOCTYPE html>
<html lang="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<head>
     <title>四棱锥二面角 Draft1</title>
     <style type="text/css">
     .centerlize{
        margin:0 auto;
        width:1200px;
     }
     </style>
     </head>

     <body onload="init();">
        <div class="centerlize">
            <canvas id="myCanvas" width="12px" height="12px" style="border:1px dotted black;">
                如果看到这段文字说您的浏览器尚不支持HTML5 Canvas,请更换浏览器再试.
            </canvas>
        </div>
     </body>
</html>
<script type="text/javascript">
<!--
/*****************************************************************
* 将全体代码(从<!DOCTYPE到script>)拷贝下来,粘贴到文本编辑器中,
* 另存为.html文件,再用chrome浏览器打开,就能看到实现效果。
******************************************************************/

// canvas的绘图环境
var ctx;

// 高宽
const WIDTH=512;
const HEIGHT=512;

// 舞台对象
var stage;

//-------------------------------
// 初始化
//-------------------------------
function init(){
    // 获得canvas对象
    var canvas=document.getElementById('myCanvas');  
    canvas.width=WIDTH;
    canvas.height=HEIGHT;

    // 初始化canvas的绘图环境
    ctx=canvas.getContext('2d');  
    ctx.translate(WIDTH/2,HEIGHT/2);// 原点平移

    // 准备
    stage=new Stage();    
    stage.init();

    // 开幕
    animate();
}

// 播放动画
function animate(){    
    stage.update();    
    stage.paintBg(ctx);
    stage.paintFg(ctx);     

    // 循环
    if(true){
        //sleep(100);
        window.requestAnimationFrame(animate);   
    }
}

// 舞台类
function Stage(){
    // 初始化
    this.init=function(){
        
    }

    // 更新
    this.update=function(){    
        
    }

    // 画背景
    this.paintBg=function(ctx){
        ctx.clearRect(-WIDTH/2,-HEIGHT/2,WIDTH,HEIGHT);// 清屏    
    }

    // 画前景
    this.paintFg=function(ctx){
        // 底色
        //ctx.save();
        //ctx.fillStyle = "black";
        //ctx.fillRect(-WIDTH/2,-HEIGHT/2,WIDTH,HEIGHT);        
        //ctx.restore();        

        const R=200;//基准尺寸    
        ctx.lineWidth=R/200*1;
        
        // #1 
        ctx.save();        
        var r=R*1.00;

        // 定位
        var o=createPt(0,r/2);
        var p=createPt2(o.x,o.y,r*1.3,-Math.PI/2);
        var f=createPt2(o.x,o.y,r,0);
        var d=createPt2(f.x,f.y,r/3,-Math.PI/4*3);
        var c=createPt2(f.x,f.y,r/3,+Math.PI/4*1);
        var e=createPt2(o.x,o.y,r,Math.PI);
        var a=createPt2(e.x,e.y,r/3,-Math.PI/4*3);
        var b=createPt2(e.x,e.y,r/3,+Math.PI/4*1);

        // PAB
        ctx.save();        
        ctx.strokeStyle="black";
        ctx.fillStyle="rgba(255,241,203,0.6)";
        ctx.beginPath();
        ctx.moveTo(a.x,a.y);
        ctx.lineTo(p.x,p.y);
        ctx.lineTo(b.x,b.y);
        ctx.closePath();
        ctx.fill();
        ctx.stroke();        
        ctx.restore();

        // PBC
        ctx.save();        
        ctx.strokeStyle="black";
        ctx.beginPath();
        ctx.moveTo(b.x,b.y);
        ctx.lineTo(c.x,c.y);
        ctx.lineTo(p.x,p.y);
        ctx.closePath();
        ctx.stroke();
        ctx.restore();

        // PCD
        ctx.save();        
        ctx.strokeStyle="black";
        ctx.setLineDash([5,5]);
        ctx.fillStyle="rgba(255,241,203,0.6)";
        ctx.beginPath();
        ctx.moveTo(c.x,c.y);
        ctx.lineTo(d.x,d.y);
        ctx.lineTo(p.x,p.y);
        ctx.fill();
        ctx.stroke();
        ctx.restore();

        // PAD
        ctx.save();        
        ctx.strokeStyle="black";
        ctx.setLineDash([5,5]);
        ctx.beginPath();
        ctx.lineTo(p.x,p.y);
        ctx.lineTo(d.x,d.y);
        ctx.lineTo(a.x,a.y);
        ctx.stroke();
        ctx.restore();

        // EFP
        ctx.save();        
        ctx.strokeStyle="black";
        ctx.setLineDash([5,5]);
        ctx.fillStyle="rgba(0,0,150,0.2)";
        ctx.beginPath();        
        ctx.lineTo(e.x,e.y);
        ctx.lineTo(f.x,f.y);
        ctx.lineTo(p.x,p.y);
        ctx.stroke();
        ctx.fill();
        ctx.restore();

        // PE
        ctx.save();        
        ctx.strokeStyle="black";
        ctx.beginPath();    
        ctx.moveTo(p.x,p.y);
        ctx.lineTo(e.x,e.y);
        ctx.stroke();
        ctx.restore();

        // PC
        ctx.save();        
        ctx.strokeStyle="black";
        ctx.beginPath();    
        ctx.moveTo(p.x,p.y);
        ctx.lineTo(c.x,c.y);
        ctx.stroke();
        ctx.restore();

        // PO
        ctx.save();        
        ctx.strokeStyle="black";
        ctx.setLineDash([5,5]);
        ctx.beginPath();    
        ctx.moveTo(p.x,p.y);
        ctx.lineTo(o.x,o.y);
        ctx.stroke();
        ctx.restore();

        // 标注点
        writeText(ctx,a.x,a.y,"a",r*0.1+"px consolas","black");
        writeText(ctx,b.x,b.y,"b",r*0.1+"px consolas","black");
        writeText(ctx,c.x,c.y,"c",r*0.1+"px consolas","black");
        writeText(ctx,d.x,d.y,"d",r*0.1+"px consolas","black");
        writeText(ctx,e.x,e.y,"e",r*0.1+"px consolas","black");
        writeText(ctx,f.x,f.y,"f",r*0.1+"px consolas","black");
        writeText(ctx,p.x,p.y,"p",r*0.1+"px consolas","black");
        writeText(ctx,o.x,o.y,"o",r*0.1+"px consolas","black");

        ctx.restore();  
                            
        writeText(ctx,WIDTH/2-30,HEIGHT/2-5,"逆火制图","8px consolas","lightgrey");// 版权
    }
}

/*----------------------------------------------------------
函数:用于绘制矩形
ctx:绘图上下文
x:矩形中心横坐标
y:矩形中心纵坐标
width:矩形宽
height:矩形高
----------------------------------------------------------*/
function drawRect(ctx,x,y,width,height){
    ctx.beginPath();
    ctx.moveTo(x-width/2,y-height/2);
    ctx.lineTo(x+width/2,y-height/2);
    ctx.lineTo(x+width/2,y+height/2);
    ctx.lineTo(x-width/2,y+height/2);
    ctx.closePath();
}

/*----------------------------------------------------------
函数:用于绘制实心圆
ctx:绘图上下文
x:矩形中心横坐标
y:矩形中心纵坐标
r:圆半径
style:填充圆的方案
----------------------------------------------------------*/
function drawSolidCircle(ctx,x,y,r,style){
    ctx.fillStyle=style;
    ctx.beginPath();
    ctx.arc(x,y,r,0,Math.PI*2,false);
    ctx.closePath();
    ctx.fill();
}

/*----------------------------------------------------------
函数:创建一个二维坐标点
baseX:基准点横坐标
baseY:基准点纵坐标
radius:当前点到基准点的距离(辐长)
theta:当前点到基准点的角度(辐角)
Pt即Point
----------------------------------------------------------*/
function createPt2(baseX,baseY,radius,theta){
    var pt={};
    pt.x=baseX+radius*Math.cos(theta);
    pt.y=baseY+radius*Math.sin(theta);
    return pt;
}

/*----------------------------------------------------------
函数:创建一个二维坐标点
x:横坐标
y:纵坐标
Pt即Point
----------------------------------------------------------*/
function createPt(x,y){
    var retval={};
    retval.x=x;
    retval.y=y;
    return retval;
}

/*----------------------------------------------------------
函数:延时若干毫秒
milliseconds:毫秒数
----------------------------------------------------------*/
function sleep(milliSeconds) {
    const date = Date.now();
    let currDate = null;
    while (currDate - date < milliSeconds) {
        currDate = Date.now();
    } 
}

/*----------------------------------------------------------
函数:书写文字
ctx:绘图上下文
x:横坐标
y:纵坐标
text:文字
font:字体
color:颜色
----------------------------------------------------------*/
function writeText(ctx,x,y,text,font,color){
    ctx.save();
    ctx.textBaseline="bottom";
    ctx.textAlign="center";
    ctx.font = font;
    ctx.fillStyle=color;
    ctx.fillText(text,x,y);
    ctx.restore();
}

/*-------------------------------------------------------------
尽量不要让别人知道你的状态,
无论好坏,好了有人嫉妒,坏了有人嘲笑,
最好的生活是:不嫉妒别人,不看轻自己,
岁月静好,别来无恙。
--------------------------------------------------------------*/
//-->
</script>

END

posted @ 2015-04-25 22:53  逆火狂飙  阅读(192)  评论(0)    收藏  举报