C++博客-脚踏实地 http://www.598club.com/jpweiyi/ ??? ?????azh-cnSat, 18 Jan 2020 01:38:19 GMTSat, 18 Jan 2020 01:38:19 GMT60C++博客-脚踏实地 http://www.598club.com/jpweiyi/archive/2019/12/08/217018.htmlLSHLSHSat, 07 Dec 2019 16:59:00 GMThttp://www.598club.com/jpweiyi/archive/2019/12/08/217018.htmlhttp://www.598club.com/jpweiyi/comments/217018.htmlhttp://www.598club.com/jpweiyi/archive/2019/12/08/217018.html#Feedback0http://www.598club.com/jpweiyi/comments/commentRss/217018.htmlhttp://www.598club.com/jpweiyi/services/trackbacks/217018.html

----------------------------------
??????????o????o?????o???!
----------------------------------




LSH 2019-12-08 00:59 ???????o
]]>
C++博客-脚踏实地 http://www.598club.com/jpweiyi/archive/2019/12/07/217016.htmlLSHLSHSat, 07 Dec 2019 07:21:00 GMThttp://www.598club.com/jpweiyi/archive/2019/12/07/217016.htmlhttp://www.598club.com/jpweiyi/comments/217016.htmlhttp://www.598club.com/jpweiyi/archive/2019/12/07/217016.html#Feedback0http://www.598club.com/jpweiyi/comments/commentRss/217016.htmlhttp://www.598club.com/jpweiyi/services/trackbacks/217016.html function CreateFPSCounter() { var mFrame; var mTo; var mFPS; var mLastTime; var mDeltaTime; var iReset = function (time) { time = time || 0; mFrame = 0; mTo = time; mFPS = 60.0; mLastTime = time; mDeltaTime = 0; } var iCount = function (time) { mFrame++; mDeltaTime = time - mLastTime; mLastTime = time; if ((time - mTo) > 500.0) { mFPS = 1000.0 * mFrame / (time - mTo); mFrame = 0; mTo = time; return true; } return false; } var iGetFPS = function () { return mFPS; } var iGetDeltaTime = function () { return mDeltaTime; } return { Reset: iReset, Count: iCount, GetFPS: iGetFPS, GetDeltaTime: iGetDeltaTime }; } function RequestFullScreen(ele) { if (ele == null) ele = document.documentElement; if (ele.requestFullscreen) ele.requestFullscreen(); else if (ele.msRequestFullscreen) ele.msRequestFullscreen(); else if (ele.mozRequestFullScreen) ele.mozRequestFullScreen(); else if (ele.webkitRequestFullscreen) ele.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT); } function Init() { if (window.init_flag === undefined) { console.log("init_flag"); var iMouse = window.iMouse = { x: 0, y: 0, z: 0, w: 0 }; var cv = document.getElementById("displayPort"); var fpsConter = CreateFPSCounter(); var context = cv.getContext('2d'); var W = cv.clientWidth; H = cv.clientHeight; var imageData = context.getImageData(0, 0, W, H); var pixels = imageData.data; for (var i = 0; i < W * H; ++i) pixels[4 * i + 3] = 255; function MainLoop(deltaTime) { var tracer = window.rayTracer; if (tracer == null) return; if (iMouse.z > 0.) tracer.ResetFrames(); var frames = tracer.CountFrames(); var i = 0, color; for (var y = 0; y < H; ++y) { for (var x = 0; x < W; ++x, ++i) { color = tracer.Render(x, y, W, H); pixels[i++] = (color.r * 255) | 0; pixels[i++] = (color.g * 255) | 0; pixels[i++] = (color.b * 255) | 0; } } context.putImageData(imageData, 0, 0); // console.log(deltaTime, fpsConter.GetFPS()) } function elementPos(element) { var x = 0, y = 0; while (element.offsetParent) { x += element.offsetLeft; y += element.offsetTop; element = element.offsetParent; } return { x: x, y: y }; } function getMouseCoords(ev, canvasElement) { var pos = elementPos(canvasElement); var mcx = (ev.pageX - pos.x) * canvasElement.width / canvasElement.offsetWidth; var mcy = (ev.pageY - pos.y) * canvasElement.height / canvasElement.offsetHeight; return { x: mcx, y: mcy }; } cv.onmousemove = function (ev) { var mouse = getMouseCoords(ev, cv); iMouse.x = mouse.x; iMouse.y = mouse.y; } cv.onmousedown = function (ev) { if (ev.button === 0) iMouse.z = 1; else if (ev.button === 2) { iMouse.w = 1; RequestFullScreen(cv); } } document.onmouseup = function (ev) { if (ev.button === 0) iMouse.z = 0; else if (ev.button === 2) iMouse.w = 0; } ; (function (loopFunc) { var fisrt = true; function L(timestamp) { if (fisrt) { fisrt = false, fpsConter.Reset(timestamp) } else { fpsConter.Count(timestamp); } loopFunc(fpsConter.GetDeltaTime()); requestAnimationFrame(L) }; requestAnimationFrame(L); })(MainLoop); window.init_flag = true; } } function CreateTracer() { try { (new Function(document.getElementById("codeEditor").value))(); window.rayTracer = new window.pt(); window.iMouse.x = window.iMouse.y = 0; var cv = document.getElementById("displayPort"); var W = cv.clientWidth; H = cv.clientHeight; window.rayTracer.CreateBackBuffer(W, H); } catch(e) { alert(e) } } Init(); CreateTracer();
??????????a????????????????ademo
??????:?|????????+?????????
??????????:??3????????




LSH 2019-12-07 15:21 ???????o
]]>
C++博客-脚踏实地 http://www.598club.com/jpweiyi/archive/2019/11/03/216962.htmlLSHLSHSun, 03 Nov 2019 15:34:00 GMThttp://www.598club.com/jpweiyi/archive/2019/11/03/216962.htmlhttp://www.598club.com/jpweiyi/comments/216962.htmlhttp://www.598club.com/jpweiyi/archive/2019/11/03/216962.html#Feedback0http://www.598club.com/jpweiyi/comments/commentRss/216962.htmlhttp://www.598club.com/jpweiyi/services/trackbacks/216962.html???o?????1??????????????o????. ?????????' : UxV????-??o?VxU, 
??????????????????????o??????a??a?|??????1???a??a??3?????????o
????????a?????,???o?????o?????o??o???????????o???????.
i,j,k?????a??o?????, ?|???????????????????????????Z??????1?????,
??3????1X????????1???Y??????o?-???1?????????????-??o?????,?|????
?????????????????????o????????????????????,???1?????????.
ixj=k, kxi=j, jxk=i 
??????????????????????????1??1???.?1?????????????????Z??????1?????,
??3????1X????????1???Y??????o?-???1?????????????-??o?????,?????????
??|???1???????1???1????o?
jxi=k, ixk=j, kxj=i 
?1????????????????????????????????o?.
???????|?????????3?????Z??????1?????,??3????1X????????1???Y????
??o?-???1?????????????-??o?????????????????????|?????1????????
???????????:
ixj=k, kxi=j, jxk=i 
?|?????????3?????Z??????1?????,?|????1X????????1???Y????
??o?-???1?????????????-??o?????????????????????|?????1????????
???????????:
jxi=k, ixk=j, kxj=i 
?1???????????????????????.
?????????1?????????????o?
???????????????????????????
?????????????x??3??o?-???1???,y?????o?-???1???,z??????1?????o?-???1????????????????
?????.

var vec3 = glMatrix.vec3;
console.log("-------------------->z?'??????1?????o?-???????????3?");
var u = vec3.fromValues(1,0,0)
var v = vec3.fromValues(0,1,0)
var w = vec3.fromValues(0,0,-1)

console.log(vec3.cross(vec3.create(), w,v));
console.log(vec3.cross(vec3.create(), u,w));
console.log(vec3.cross(vec3.create(), v,u));
console.log("-------------------->y?'????????o?-???????????3?");
var u = vec3.fromValues(1,0,0)
var v = vec3.fromValues(0,-1,0)
var w = vec3.fromValues(0,0,1)

console.log(vec3.cross(vec3.create(), w,v));
console.log(vec3.cross(vec3.create(), u,w));
console.log(vec3.cross(vec3.create(), v,u));
console.log("-------------------->x?'????|??o?-???????????3?");
var u = vec3.fromValues(-1,0,0)
var v = vec3.fromValues(0,1,0)
var w = vec3.fromValues(0,0,1)

console.log(vec3.cross(vec3.create(), w,v));
console.log(vec3.cross(vec3.create(), u,w));
console.log(vec3.cross(vec3.create(), v,u));
console.log("-------------------->????????o?-????????3?");
var u = vec3.fromValues(-1,0,0)
var v = vec3.fromValues(0,-1,0)
var w = vec3.fromValues(0,0,-1)
console.log(vec3.cross(vec3.create(), w,v));
console.log(vec3.cross(vec3.create(), u,w));
console.log(vec3.cross(vec3.create(), v,u));

????????????????-???????????????

console.log("-------------------->z?'??????1?????o?-????????3?");
var u = vec3.fromValues(1,0,0)
var v = vec3.fromValues(0,1,0)
var w = vec3.fromValues(0,0,1)
console.log(vec3.cross(vec3.create(), v,w));
console.log(vec3.cross(vec3.create(), w,u));
console.log(vec3.cross(vec3.create(), u,v));
console.log("-------------------->??????????a?????o'?????????????3?");
var u = vec3.fromValues(-1,0,0)
var v = vec3.fromValues(0,1,0)
var w = vec3.fromValues(0,0,-1)
console.log(vec3.cross(vec3.create(), v,w));
console.log(vec3.cross(vec3.create(), w,u));
console.log(vec3.cross(vec3.create(), u,v));

???????1???????????-???????????????.
????o?????|?????????????????-?????????,?|???????????????????
????????????.


LSH 2019-11-03 23:34 ???????o
]]>
C++博客-脚踏实地 http://www.598club.com/jpweiyi/archive/2019/06/26/216460.htmlLSHLSHWed, 26 Jun 2019 04:57:00 GMThttp://www.598club.com/jpweiyi/archive/2019/06/26/216460.htmlhttp://www.598club.com/jpweiyi/comments/216460.htmlhttp://www.598club.com/jpweiyi/archive/2019/06/26/216460.html#Feedback0http://www.598club.com/jpweiyi/comments/commentRss/216460.htmlhttp://www.598club.com/jpweiyi/services/trackbacks/216460.html
// ??????:?-???n???????????
// n ?-???n
// return ?????
function A(n) {
if (n <= 0) return n;
var sum = 1;
for (var i = n; i > 0; --i) {
sum *= i;
}
return sum;
}

// ??????:???n??a??-?????m??a?????????
// n ?-???n
// m ?-???m
// return ?????
function C(n, m) {
return A(n) / (A(m) * A(n - m));
}

// ???????????: ???array??-?????n??a????'??????????
// array ?????
// n ?-???n
// return ????????????
function ArrayComb(array, n) {
var result = [], t = [], e;

function Recursion(index, array, n, t, result) {
if (t.length === n) { result.push(t.slice()); return };

for (var i = index; i < array.length; ++i) {
e = array[i];
t.push(e);
Recursion(i + 1, array, n, t, result);
t.pop();
}
}

Recursion(0, array, n, t, result);
return result;
}


LSH 2019-06-26 12:57 ???????o
]]>
C++博客-脚踏实地 http://www.598club.com/jpweiyi/archive/2018/03/23/215560.htmlLSHLSHThu, 22 Mar 2018 16:27:00 GMThttp://www.598club.com/jpweiyi/archive/2018/03/23/215560.htmlhttp://www.598club.com/jpweiyi/comments/215560.htmlhttp://www.598club.com/jpweiyi/archive/2018/03/23/215560.html#Feedback0http://www.598club.com/jpweiyi/comments/commentRss/215560.htmlhttp://www.598club.com/jpweiyi/services/trackbacks/215560.html?????????

LSH 2018-03-23 00:27 ???????o
]]>
C++博客-脚踏实地 http://www.598club.com/jpweiyi/archive/2017/01/19/214612.htmlLSHLSHThu, 19 Jan 2017 15:36:00 GMThttp://www.598club.com/jpweiyi/archive/2017/01/19/214612.htmlhttp://www.598club.com/jpweiyi/comments/214612.htmlhttp://www.598club.com/jpweiyi/archive/2017/01/19/214612.html#Feedback0http://www.598club.com/jpweiyi/comments/commentRss/214612.htmlhttp://www.598club.com/jpweiyi/services/trackbacks/214612.html<html><head><title>???????????? (1.0)</title><meta charset="utf-8">&l...  ?????????

LSH 2017-01-19 23:36 ???????o
]]>
C++博客-脚踏实地 http://www.598club.com/jpweiyi/archive/2016/12/16/214505.htmlLSHLSHFri, 16 Dec 2016 08:44:00 GMThttp://www.598club.com/jpweiyi/archive/2016/12/16/214505.htmlhttp://www.598club.com/jpweiyi/comments/214505.htmlhttp://www.598club.com/jpweiyi/archive/2016/12/16/214505.html#Feedback0http://www.598club.com/jpweiyi/comments/commentRss/214505.htmlhttp://www.598club.com/jpweiyi/services/trackbacks/214505.html
//>this is a Quine program implement by c language.
//>reference http://www.madore.org/~david/computers/quine.html
#include <stdio.h>
int main(void){
  char n='\n'; char g='\\'; char q='"'; char s=';';
  char*s1="//>this is a Quine program implement by c language.%c//>reference http://www.madore.org/~david/computers/quine.html%c#include <stdio.h>%cint main(void){%c  char n='%cn'; char g='%c%c'; char q='%c'; char s=';';%c  char*s1=%c%s%c;%c  printf(s1,n,n,n,n,g,g,g,q,n,q,s1,q,n,s,n,s,n)%c%c  return 0%c%c}";
  printf(s1,n,n,n,n,g,g,g,q,n,q,s1,q,n,s,n,s,n);
  return 0;
}
javascript
var c1='"'; var c2='\n'; var c3='\\'; var c4=';';
var s1="var c1='%c1'; var c2='%c3n'; var c3='%c3%c3'; var c4=';';%c2var s1=%c1%s1%c1%c4%c2console.log((((((((((s1.replace('%c1', c1)).replace('%c1', c1)).replace('%c1', c1)).replace('%c2', c2)).replace('%c2', c2)).replace('%c3', c3)).replace('%c3', c3)).replace('%c3', c3)).replace('%c4', c4)).replace('%s1', s1))";
console.log((((((((((s1.replace('%c1', c1)).replace('%c1', c1)).replace('%c1', c1)).replace('%c2', c2)).replace('%c2', c2)).replace('%c3', c3)).replace('%c3', c3)).replace('%c3', c3)).replace('%c4', c4)).replace('%s1', s1))


LSH 2016-12-16 16:44 ???????o
]]>
C++博客-脚踏实地 http://www.598club.com/jpweiyi/archive/2016/10/02/214312.htmlLSHLSHSun, 02 Oct 2016 12:33:00 GMThttp://www.598club.com/jpweiyi/archive/2016/10/02/214312.htmlhttp://www.598club.com/jpweiyi/comments/214312.htmlhttp://www.598club.com/jpweiyi/archive/2016/10/02/214312.html#Feedback0http://www.598club.com/jpweiyi/comments/commentRss/214312.htmlhttp://www.598club.com/jpweiyi/services/trackbacks/214312.html
<script type="text/javascript">
 
        void function(global)
        {
            var mapping = {}, cache = {};
            global.define = function(id, func){
                mapping[id] = func;
            };
            
            global.require = function(id){
                if(cache[id])
                    return cache[id];
                else
                    return cache[id] = mapping[id]({});
            };
        }(this);
        
        define("moduleA", function(exports)
        {
            function ClassA(){
            }
            
            ClassA.prototype.print = function(){
                alert("moduleA.ClassA")
            }
            
            exports.New = function(){
                return new ClassA();
            }
        
            return exports;
            
        });
        
        define("moduleB", function(exports)
        {
            function ClassB(){
            }
        
            ClassB.prototype.print = function(){
                alert("moduleB.ClassB")
            }
            
            exports.New = function(){
                return new ClassB();
            }
            
            return exports;
        });
        
        define("moduleC", function(exports)
        {
            function ClassC(){
            }
        
            ClassC.prototype.print = function(){
                var classA = require("moduleA").New();
                classA.print();
                    
                var classB = require("moduleB").New();
                classB.print();
                    
                alert("moduleC.ClassC")
            }
            
            exports.New = function(){
                return new ClassC();
            }
            
            return exports;
        });
        
        var classC = require("moduleC").New();
        classC.print();
        
      </script>


LSH 2016-10-02 20:33 ???????o
]]>
C++博客-脚踏实地 http://www.598club.com/jpweiyi/archive/2016/09/19/214281.htmlLSHLSHSun, 18 Sep 2016 19:07:00 GMThttp://www.598club.com/jpweiyi/archive/2016/09/19/214281.htmlhttp://www.598club.com/jpweiyi/comments/214281.htmlhttp://www.598club.com/jpweiyi/archive/2016/09/19/214281.html#Feedback0http://www.598club.com/jpweiyi/comments/commentRss/214281.htmlhttp://www.598club.com/jpweiyi/services/trackbacks/214281.html
@echo off
:Main
setlocal EnableDelayedExpansion
call :ShowInputIP
call :CheckIP
if %errorlevel% == 1 (
    call :TrackIP !IP! 1
)
setlocal DisableDelayedExpansion
goto :Main
::---------------------------------------------------------------
:TrackIP
ping %1 -n 2 -i %2 >rs.txt
set /a c=%2+1
if %c% geq 65 (
    echo ????oTTL?????[65]
    ping %1 -n 1
    goto :eof
)
for /f "tokens=1-5* delims= " %%i in (rs.txt) do (
    if "%%i" == "????a" (
        echo    ???a??IP[%%j] TTL=%2
        if %%j == !IP! (
            echo ???a??????!!! 
        ) else (
            call :TrackIP %1 %c%
        )
        goto :eof
    ) else (
        if "%%i" == "???????????" ( 
            echo 3?TTL  [TTL=%2%] 
            call :TrackIP %1 %c% 
            goto :eof
        )
    )
)
goto :eof
::---------------------------------------------------------------
:ShowInputIP
echo ??????|???a ip/?????? ?????:
set /p IP=
goto :eof
::---------------------------------------------------------------
:CheckIP
ping %IP% -n 1 >temp.txt
set context=
for /f "tokens=1-5* delims= " %%i in (temp.txt) do (
    if "%%m" == "?????" (
        set context=%%l
        set IP=!context:~1,-1!
        echo ?????????? [%IP%] → IP [!IP!]
        goto :CheckEnd
    )
)
:CheckEnd
del temp.txt
exit /b 1


LSH 2016-09-19 03:07 ???????o
]]>
C++博客-脚踏实地 http://www.598club.com/jpweiyi/archive/2016/09/04/214256.htmlLSHLSHSun, 04 Sep 2016 06:32:00 GMThttp://www.598club.com/jpweiyi/archive/2016/09/04/214256.html// x???o?,?-??o?0?????0,x??o?0?????1
// if x <= 0 return 0 and x > 0 return 1.
float LQZ(x){
   return max(0, sign(x));
   // return ceil(clamp(0.,1.,x));
}

// if x <= 0 return a and x > 0 return b
// x???o?,?-??o?0?????a,x??o?0?????b
float v = mix(a, b, LQZ(x));  

// if x is odd number (0~1,2~3,4~5,6~7) return a else return b
// ????????(0~1,2~3,4~5,...)?????a,????????(1~2,3~4)?????b
float v = mix(a, b, LQZ(mod(x,2.0) - 1.0));

LSH 2016-09-04 14:32 ???????o
]]>