threejs學習day02

場景、相機、渲染器

一、創建3D場景

// 引入threejs
import * as THREE from 'three'// 創建一個三維場景scene
const scene = new THREE.Scene();// 給三維場景添加物品
const geometry = new THREE.BoxGeometry(100,100,100)   // 形狀
const meterial = new THREE.MeshBasicMaterial({color:0x00ff00})   // 材質const mesh = new THREE.Mesh(geometry, meterial)  // 網格模型(形狀,材質)
mesh.position.set(0,10,0)  // 網格模型的位置scene.add(mesh)
// console.log(scene)

二、透視投影相機

// 引入threejs
import * as THREE from 'three'// 創建一個三維場景scene
const scene = new THREE.Scene();// 給三維場景添加物品
const geometry = new THREE.BoxGeometry(100,100,100)   // 形狀
const meterial = new THREE.MeshBasicMaterial({color:0x00ff00})   // 材質const mesh = new THREE.Mesh(geometry, meterial)  // 網格模型(形狀,材質)
mesh.position.set(0,10,0)  // 網格模型的位置scene.add(mesh)
// console.log(scene)// 定義相機輸出畫布的尺寸(單位:像素px)
const width = 800
const height = 500// 創建一個透視圖投影相機對象
const camera = new THREE.PerspectiveCamera(30,width/height, 0.1,2000)  // 視野角度、寬高比、近端面、遠端面
camera.position.set(200,200,200)  // 設置相機位置// 相機的視線,觀察目標點的坐標
// camera.lookAt(0,0,0) 
// camera.lookAt(0,10,0)  // y軸上一點
camera.lookAt(mesh.position)  // 指向網格模型mesh

三、渲染

// 引入threejs
import * as THREE from 'three'// 創建一個三維場景scene
const scene = new THREE.Scene();// 給三維場景添加物品
const geometry = new THREE.BoxGeometry(50,50,50)   // 形狀
const meterial = new THREE.MeshBasicMaterial({color:0x00ff00})   // 材質const mesh = new THREE.Mesh(geometry, meterial)  // 網格模型(形狀,材質)
mesh.position.set(0,10,0)  // 網格模型的位置scene.add(mesh)
// console.log(scene)// 定義相機輸出畫布的尺寸(單位:像素px)
const width = 800
const height = 500// 創建一個透視圖投影相機對象
const camera = new THREE.PerspectiveCamera(30,width/height, 0.1,2000)  // 視野角度、寬高比、近端面、遠端面
camera.position.set(200,200,200)  // 設置相機位置// 相機的視線,觀察目標點的坐標
// camera.lookAt(0,0,0) 
// camera.lookAt(0,10,0)  // y軸上一點
camera.lookAt(mesh.position)  // 指向網格模型mesh// 創建渲染器對象
const renderer = new THREE.WebGLRenderer();
renderer.setSize(width, height)   // canvas畫布的寬度和高度
renderer.render(scene, camera)  // 拍照;執行一個渲染操作// 把渲染結果,添加到網頁頁面上
document.body.appendChild(renderer.domElement)

四、結果展示

五、三維坐標系

顯示x,y,z三個坐標軸

六、光源對物體表面的影響

// 引入threejs
import * as THREE from 'three'// 創建一個三維場景scene
const scene = new THREE.Scene();// 給三維場景添加物品
const geometry = new THREE.BoxGeometry(50,50,50)   // 形狀
const meterial = new THREE.MeshLambertMaterial({  // 受光源影響的;→設置光照color:0x00ff00,  // 設置材質顏色transparent:true,  // 開啟透明opacity:0.5  // 設置透明度
})   // 設置光源對象  
const pointLight = new THREE.PointLight(0xffffff, 1,0)   // 光源強度、顏色
// pointLight.intensity = 10   // 光源強度
pointLight.decay = 0.0   // 不隨著距離的改變而衰減光源
// pointLight.position.set(400,0,0) // 光源設置在x軸上
pointLight.position.set(400,50,200)  // 光源位置設置
scene.add(pointLight)  // 光源添加到場景中const mesh = new THREE.Mesh(geometry, meterial)  // 網格模型(形狀,材質)
mesh.position.set(0,0,0)  // 網格模型的位置  x,y,zscene.add(mesh)
// console.log(scene)// 創建一個三維坐標軸
const axesHelper = new THREE.AxesHelper(100)
scene.add(axesHelper)   // 將坐標對象,添加到三維場景中// 定義相機輸出畫布的尺寸(單位:像素px)
const width = 800
const height = 500// 創建一個透視圖投影相機對象
const camera = new THREE.PerspectiveCamera(30,width/height, 0.1,2000)  // 視野角度、寬高比、近端面、遠端面
camera.position.set(200,200,200)  // 設置相機位置
// camera.position.set(-1000,0,0)// 相機的視線,觀察目標點的坐標
camera.lookAt(0,0,0)   // 指向坐標原點
// camera.lookAt(0,10,0)  // y軸上一點
// camera.lookAt(mesh.position)  // 指向網格模型mesh// 創建渲染器對象
const renderer = new THREE.WebGLRenderer();
renderer.setSize(width, height)   // canvas畫布的寬度和高度
renderer.render(scene, camera)  // 拍照;執行一個渲染操作// 把渲染結果,添加到網頁頁面上
document.body.appendChild(renderer.domElement)

七、相機軌道控件

// 引入threejs
import * as THREE from 'three'
// 引入軌道控制器擴展庫
import {OrbitControls} from 'three/addons/controls/OrbitControls.js'// 創建一個三維場景scene
const scene = new THREE.Scene();// 給三維場景添加物品
const geometry = new THREE.BoxGeometry(50,50,50)   // 形狀
const meterial = new THREE.MeshLambertMaterial({  // 受光源影響的;→設置光照color:0x00ff00,  // 設置材質顏色transparent:true,  // 開啟透明opacity:0.5  // 設置透明度
})   // 設置光源對象  
const pointLight = new THREE.PointLight(0xffffff, 1,0)   // 光源強度、顏色
// pointLight.intensity = 10   // 光源強度
pointLight.decay = 0.0   // 不隨著距離的改變而衰減光源
// pointLight.position.set(400,0,0) // 光源設置在x軸上
pointLight.position.set(400,50,200)  // 光源位置設置
scene.add(pointLight)  // 光源添加到場景中const mesh = new THREE.Mesh(geometry, meterial)  // 網格模型(形狀,材質)
mesh.position.set(0,0,0)  // 網格模型的位置  x,y,zscene.add(mesh)
// console.log(scene)// 創建一個三維坐標軸
const axesHelper = new THREE.AxesHelper(100)
scene.add(axesHelper)   // 將坐標對象,添加到三維場景中// 定義相機輸出畫布的尺寸(單位:像素px)
const width = 800
const height = 500// 創建一個透視圖投影相機對象
const camera = new THREE.PerspectiveCamera(30,width/height, 0.1,2000)  // 視野角度、寬高比、近端面、遠端面
camera.position.set(200,200,200)  // 設置相機位置
// camera.position.set(-1000,0,0)// 相機的視線,觀察目標點的坐標
camera.lookAt(0,0,0)   // 指向坐標原點
// camera.lookAt(0,10,0)  // y軸上一點
// camera.lookAt(mesh.position)  // 指向網格模型mesh// 創建渲染器對象
const renderer = new THREE.WebGLRenderer();
renderer.setSize(width, height)   // canvas畫布的寬度和高度
renderer.render(scene, camera)  // 拍照;執行一個渲染操作// 把渲染結果,添加到網頁頁面上
document.body.appendChild(renderer.domElement)// 設置相機空間軌道控制器
const controls = new OrbitControls(camera, renderer.domElement)   // 參數:相機  參數2:監控范圍
controls.addEventListener('change',function(){renderer.render(scene, camera)  // 執行渲染操作
})

八、光源

// 引入threejs
import * as THREE from 'three'
// 引入軌道控制器擴展庫
import {OrbitControls} from 'three/addons/controls/OrbitControls.js'// 創建一個三維場景scene
const scene = new THREE.Scene();// 給三維場景添加物品
const geometry = new THREE.BoxGeometry(100,100,100)   // 形狀
const meterial = new THREE.MeshLambertMaterial({  // 受光源影響的;→設置光照color:0x00ff00,  // 設置材質顏色transparent:true,  // 開啟透明opacity:0.5  // 設置透明度
})   /*** 光源設置*/
// 設置光源對象  
const pointLight = new THREE.PointLight(0xffffff, 1,0)   // 光源強度、顏色
// pointLight.intensity = 10   // 光源強度
pointLight.decay = 0.0   // 不隨著距離的改變而衰減光源
// pointLight.position.set(400,0,0) // 光源設置在x軸上
pointLight.position.set(400,50,200)  // 光源位置設置
scene.add(pointLight)  // 光源添加到場景中/*** 可視化點光源* */
const pointLightHelper = new THREE.PointLightHelper(pointLight, 10)
scene.add(pointLightHelper)/**** 添加環境光*/
const ambient = new THREE.AmbientLight(0xffffff, 0.4)
scene.add(ambient)/*** 添加一個平行光*/
const directionLight = new THREE.DirectionalLight(0xffffff, 1.0)
directionLight.position.set(50,100,60)  // 平行線光源位置
// directionLight.target = mesh;  // 目標光源位置   ,(不設置,默認是坐標原點)
scene.add(directionLight)const mesh = new THREE.Mesh(geometry, meterial)  // 網格模型(形狀,材質)
mesh.position.set(0,0,0)  // 網格模型的位置  x,y,zscene.add(mesh)
// console.log(scene)// 創建一個三維坐標軸
const axesHelper = new THREE.AxesHelper(100)
scene.add(axesHelper)   // 將坐標對象,添加到三維場景中// 定義相機輸出畫布的尺寸(單位:像素px)
const width = 800
const height = 500// 創建一個透視圖投影相機對象
const camera = new THREE.PerspectiveCamera(30,width/height, 0.1,2000)  // 視野角度、寬高比、近端面、遠端面
camera.position.set(200,200,200)  // 設置相機位置
// camera.position.set(-1000,0,0)// 相機的視線,觀察目標點的坐標
camera.lookAt(0,0,0)   // 指向坐標原點
// camera.lookAt(0,10,0)  // y軸上一點
// camera.lookAt(mesh.position)  // 指向網格模型mesh// 創建渲染器對象
const renderer = new THREE.WebGLRenderer();
renderer.setSize(width, height)   // canvas畫布的寬度和高度
renderer.render(scene, camera)  // 拍照;執行一個渲染操作// 把渲染結果,添加到網頁頁面上
document.body.appendChild(renderer.domElement)// 設置相機空間軌道控制器
const controls = new OrbitControls(camera, renderer.domElement)   // 參數:相機  參數2:監控范圍
controls.addEventListener('change',function(){renderer.render(scene, camera)  // 執行渲染操作
})

九、動畫渲染 循環

// 引入threejs
import * as THREE from 'three'
// 引入軌道控制器擴展庫
import {OrbitControls} from 'three/addons/controls/OrbitControls.js'// 創建一個三維場景scene
const scene = new THREE.Scene();// 給三維場景添加物品
const geometry = new THREE.BoxGeometry(100,100,100)   // 形狀
const meterial = new THREE.MeshLambertMaterial({  // 受光源影響的;→設置光照color:0x00ff00,  // 設置材質顏色transparent:true,  // 開啟透明opacity:0.5  // 設置透明度
})   /*** 光源設置*/
// 設置光源對象  
const pointLight = new THREE.PointLight(0xffffff, 1,0)   // 光源強度、顏色
// pointLight.intensity = 10   // 光源強度
pointLight.decay = 0.0   // 不隨著距離的改變而衰減光源
// pointLight.position.set(400,0,0) // 光源設置在x軸上
pointLight.position.set(400,50,200)  // 光源位置設置
scene.add(pointLight)  // 光源添加到場景中/*** 可視化點光源* */
const pointLightHelper = new THREE.PointLightHelper(pointLight, 10)
scene.add(pointLightHelper)/**** 添加環境光*/
const ambient = new THREE.AmbientLight(0xffffff, 0.4)
scene.add(ambient)/*** 添加一個平行光*/
const directionLight = new THREE.DirectionalLight(0xffffff, 1.0)
directionLight.position.set(50,100,60)  // 平行線光源位置
// directionLight.target = mesh;  // 目標光源位置   ,(不設置,默認是坐標原點)
scene.add(directionLight)const mesh = new THREE.Mesh(geometry, meterial)  // 網格模型(形狀,材質)
mesh.position.set(0,0,0)  // 網格模型的位置  x,y,zscene.add(mesh)
// console.log(scene)// 創建一個三維坐標軸
const axesHelper = new THREE.AxesHelper(100)
scene.add(axesHelper)   // 將坐標對象,添加到三維場景中// 定義相機輸出畫布的尺寸(單位:像素px)
const width = 800
const height = 500// 創建一個透視圖投影相機對象
const camera = new THREE.PerspectiveCamera(30,width/height, 0.1,2000)  // 視野角度、寬高比、近端面、遠端面
camera.position.set(200,200,200)  // 設置相機位置
// camera.position.set(-1000,0,0)// 相機的視線,觀察目標點的坐標
camera.lookAt(0,0,0)   // 指向坐標原點
// camera.lookAt(0,10,0)  // y軸上一點
// camera.lookAt(mesh.position)  // 指向網格模型mesh// 創建渲染器對象
const renderer = new THREE.WebGLRenderer();
renderer.setSize(width, height)   // canvas畫布的寬度和高度
// renderer.render(scene, camera)  // 拍照;執行一個渲染操作// 把渲染結果,添加到網頁頁面上
document.body.appendChild(renderer.domElement)// 設置相機空間軌道控制器
const controls = new OrbitControls(camera, renderer.domElement)   // 參數:相機  參數2:監控范圍
controls.addEventListener('change',function(){renderer.render(scene, camera)  // 執行渲染操作
})// 周期性執行,默認理想狀態下 (渲染循環)
function render(){mesh.rotateY(0.01)  // 周期性旋轉,每次旋轉一定度數renderer.render(scene, camera)  // 周期性執行相機的渲染功能,更新canvas畫布上的內容requestAnimationFrame(render);  // 默認每秒調用60次 
}
render()

十、canvas畫布布局和全屏

// 引入threejs
import * as THREE from 'three'
// 引入軌道控制器擴展庫
import {OrbitControls} from 'three/addons/controls/OrbitControls.js'// 創建一個三維場景scene
const scene = new THREE.Scene();// 給三維場景添加物品
const geometry = new THREE.BoxGeometry(100,100,100)   // 形狀
const meterial = new THREE.MeshLambertMaterial({  // 受光源影響的;→設置光照color:0x00ff00,  // 設置材質顏色transparent:true,  // 開啟透明opacity:0.5  // 設置透明度
})   /*** 光源設置*/
// 設置光源對象  
const pointLight = new THREE.PointLight(0xffffff, 1,0)   // 光源強度、顏色
// pointLight.intensity = 10   // 光源強度
pointLight.decay = 0.0   // 不隨著距離的改變而衰減光源
// pointLight.position.set(400,0,0) // 光源設置在x軸上
pointLight.position.set(400,50,200)  // 光源位置設置
scene.add(pointLight)  // 光源添加到場景中/*** 可視化點光源* */
const pointLightHelper = new THREE.PointLightHelper(pointLight, 10)
scene.add(pointLightHelper)/**** 添加環境光*/
const ambient = new THREE.AmbientLight(0xffffff, 0.4)
scene.add(ambient)/*** 添加一個平行光*/
const directionLight = new THREE.DirectionalLight(0xffffff, 1.0)
directionLight.position.set(50,100,60)  // 平行線光源位置
// directionLight.target = mesh;  // 目標光源位置   ,(不設置,默認是坐標原點)
scene.add(directionLight)const mesh = new THREE.Mesh(geometry, meterial)  // 網格模型(形狀,材質)
mesh.position.set(0,0,0)  // 網格模型的位置  x,y,zscene.add(mesh)
// console.log(scene)// 創建一個三維坐標軸
const axesHelper = new THREE.AxesHelper(100)
scene.add(axesHelper)   // 將坐標對象,添加到三維場景中// 定義相機輸出畫布的尺寸(單位:像素px)
const width = window.innerWidth
const height = window.innerHeight// 瀏覽器窗口被調整
window.onresize = function(){// 重置渲染器輸出畫布canvas尺寸renderer.setSize(window.innerWidth, window.innerHeight)// 全屏情況下,設置寬高比camera.aspect = window.innerWidth / window.innerHeight // 更新投影矩陣camera.updateProjectionMatrix()
}// 創建一個透視圖投影相機對象
const camera = new THREE.PerspectiveCamera(30,width/height, 0.1,2000)  // 視野角度、寬高比、近端面、遠端面
camera.position.set(200,200,200)  // 設置相機位置
// camera.position.set(-1000,0,0)// 相機的視線,觀察目標點的坐標
camera.lookAt(0,0,0)   // 指向坐標原點
// camera.lookAt(0,10,0)  // y軸上一點
// camera.lookAt(mesh.position)  // 指向網格模型mesh// 創建渲染器對象
const renderer = new THREE.WebGLRenderer();
renderer.setSize(width, height)   // canvas畫布的寬度和高度
// renderer.render(scene, camera)  // 拍照;執行一個渲染操作// 把渲染結果,添加到網頁頁面上
document.body.appendChild(renderer.domElement)// 設置相機空間軌道控制器
const controls = new OrbitControls(camera, renderer.domElement)   // 參數:相機  參數2:監控范圍
controls.addEventListener('change',function(){renderer.render(scene, camera)  // 執行渲染操作
})// 周期性執行,默認理想狀態下 (渲染循環)
function render(){mesh.rotateY(0.01)  // 周期性旋轉,每次旋轉一定度數renderer.render(scene, camera)  // 周期性執行相機的渲染功能,更新canvas畫布上的內容requestAnimationFrame(render);  // 默認每秒調用60次 
}
render()

十一、Stats查看渲染幀率

// 引入threejs
import * as THREE from 'three'
// 引入軌道控制器擴展庫
import {OrbitControls} from 'three/addons/controls/OrbitControls.js'
// 引入Stats性能監視器
import Stats from 'three/addons/libs/stats.module.js'
// 創建stats對象
const stats = new Stats()
document.body.appendChild(stats.domElement)  // stats.domElement: web頁面上輸出計算結果,一個div元素// 創建一個三維場景scene
const scene = new THREE.Scene();// 給三維場景添加物品
const geometry = new THREE.BoxGeometry(100,100,100)   // 形狀
const meterial = new THREE.MeshLambertMaterial({  // 受光源影響的;→設置光照color:0x00ff00,  // 設置材質顏色transparent:true,  // 開啟透明opacity:0.5  // 設置透明度
})   /*** 光源設置*/
// 設置光源對象  
const pointLight = new THREE.PointLight(0xffffff, 1,0)   // 光源強度、顏色
// pointLight.intensity = 10   // 光源強度
pointLight.decay = 0.0   // 不隨著距離的改變而衰減光源
// pointLight.position.set(400,0,0) // 光源設置在x軸上
pointLight.position.set(400,50,200)  // 光源位置設置
scene.add(pointLight)  // 光源添加到場景中/*** 可視化點光源* */
const pointLightHelper = new THREE.PointLightHelper(pointLight, 10)
scene.add(pointLightHelper)/**** 添加環境光*/
const ambient = new THREE.AmbientLight(0xffffff, 0.4)
scene.add(ambient)/*** 添加一個平行光*/
const directionLight = new THREE.DirectionalLight(0xffffff, 1.0)
directionLight.position.set(50,100,60)  // 平行線光源位置
// directionLight.target = mesh;  // 目標光源位置   ,(不設置,默認是坐標原點)
scene.add(directionLight)const mesh = new THREE.Mesh(geometry, meterial)  // 網格模型(形狀,材質)
mesh.position.set(0,0,0)  // 網格模型的位置  x,y,zscene.add(mesh)
// console.log(scene)// 創建一個三維坐標軸
const axesHelper = new THREE.AxesHelper(100)
scene.add(axesHelper)   // 將坐標對象,添加到三維場景中// 定義相機輸出畫布的尺寸(單位:像素px)
const width = window.innerWidth
const height = window.innerHeight// 瀏覽器窗口被調整
window.onresize = function(){// 重置渲染器輸出畫布canvas尺寸renderer.setSize(window.innerWidth, window.innerHeight)// 全屏情況下,設置寬高比camera.aspect = window.innerWidth / window.innerHeight // 更新投影矩陣camera.updateProjectionMatrix()
}// 創建一個透視圖投影相機對象
const camera = new THREE.PerspectiveCamera(30,width/height, 0.1,2000)  // 視野角度、寬高比、近端面、遠端面
camera.position.set(200,200,200)  // 設置相機位置
// camera.position.set(-1000,0,0)// 相機的視線,觀察目標點的坐標
camera.lookAt(0,0,0)   // 指向坐標原點
// camera.lookAt(0,10,0)  // y軸上一點
// camera.lookAt(mesh.position)  // 指向網格模型mesh// 創建渲染器對象
const renderer = new THREE.WebGLRenderer();
renderer.setSize(width, height)   // canvas畫布的寬度和高度
// renderer.render(scene, camera)  // 拍照;執行一個渲染操作// 把渲染結果,添加到網頁頁面上
document.body.appendChild(renderer.domElement)// 設置相機空間軌道控制器
const controls = new OrbitControls(camera, renderer.domElement)   // 參數:相機  參數2:監控范圍
controls.addEventListener('change',function(){renderer.render(scene, camera)  // 執行渲染操作
})// 周期性執行,默認理想狀態下 (渲染循環)
function render(){// mesh.rotateY(0.01)  // 周期性旋轉,每次旋轉一定度數stats.update();  // 刷新時間renderer.render(scene, camera)  // 周期性執行相機的渲染功能,更新canvas畫布上的內容requestAnimationFrame(render);  // 默認每秒調用60次 
}
render()

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/pingmian/78451.shtml
繁體地址,請注明出處:http://hk.pswp.cn/pingmian/78451.shtml
英文地址,請注明出處:http://en.pswp.cn/pingmian/78451.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

K8S Pod 常見數據存儲方案

假設有如下三個節點的 K8S 集群: k8s31master 是控制節點 k8s31node1、k8s31node2 是工作節點 容器運行時是 containerd 一、理論介紹 1.1、Volumes 卷 Kubernetes 的卷是 pod 的?個組成部分,因此像容器?樣在 pod 的規范(pod.spec&#x…

【MySQL數據庫】函數操作

目錄 1,日期函數 2,字符串函數 3,數學函數 1,日期函數 樣例: 獲得年月日 select current_date(); 獲取時分秒 select current_time(); 獲得時間戳 select current_timestamp(); 在日期的基礎上加日期 在2025年4月27…

【每日隨筆】文化屬性 ① ( 天機 | 強勢文化與弱勢文化 | 文化屬性的形成與改變 | 強勢文化 具備的特點 )

文章目錄 一、文化屬性1、天機2、文化屬性的強勢文化與弱勢文化強勢文化弱勢文化 二、文化屬性的形成與改變1、文化屬性形成2、文化屬性改變3、文化知識的階層 三、強勢文化 具備的 特點 一、文化屬性 1、天機 如果想要 了解這個世界的 底層架構 , 就需要掌握 洞察事物本質 的能…

【Fifty Project - D18】

感覺自己就不是計劃星球人,雖然fifty project要求每天早上完成一天的計劃,但是對于一個p人腦子,強制自己按照計劃行事真的太難了。我也理解在早晨花費時間做好一天的計劃有很多好處,但是實際行動起來完成率極低。p人的世界里變動太…

Linux系統編程 day11 鎖 (兩天沒有更新了,中期完就休息了)

鎖的注意事項 1、盡量保證鎖的粒度,越小越好。(訪問共享數據前,加鎖,訪問結束后立即解鎖) 2、互斥鎖,本質是結構體,但是可以看成整數,初值為1。(pthread_mutex_init調用成功) 3、加鎖: --操作…

【Maven】特殊pom.xml配置文件 - BOM

文章目錄 特殊pom.xml配置文件 - BOM一、例子二、注意事項1.特殊的子pom.xml文件2.dependencyManagement 特殊pom.xml配置文件 - BOM 僅用于集中管理項目依賴版本 在 Maven 中,BOM 用于定義一個項目的依賴版本的集合,通常用于管理一組共享的依賴版本。這…

《代碼整潔之道》第5章 格式 - 筆記

你應該選擇一套管理代碼格式的簡單規則。如果是團隊,應該選擇一套團隊一致同意采用的簡單格式規則。 最重要的原則:一致性(Consistency)! 沒有完美的格式規范,但有統一的規范。 整個團隊(或者…

C++ 類與對象(中)—— 默認成員函數與運算符重載的深度解析:構造函數,析構函數,拷貝構造函數,賦值運算符重載,普通取地址重載,const取地址重載

在 C 中,類的默認成員函數是編譯器自動生成的重要機制,合理利用這些函數可以簡化代碼編寫,同時避免資源管理錯誤。本文將從構造函數、析構函數、拷貝構造函數、賦值運算符重載等核心內容展開,結合具體案例深入解析。 一、默認成員…

【KWDB創作者計劃】_企業級多模數據庫實戰:用KWDB實現時序+關系數據毫秒級融合(附代碼、性能優化與架構圖)

一、技術背景與行業痛點 1.1 多模數據融合挑戰 場景痛點: 工業物聯網設備每秒產生百萬級傳感器數據(時序數據)。需關聯設備檔案(關系數據)生成設備健康報告,傳統方案需多數據庫跳轉,延遲>5…

w~嵌入式C語言~合集4

我自己的原文哦~ https://blog.51cto.com/whaosoft/13870376 一、STM32怎么選型 什么是 STM32 STM32,從字面上來理解,ST是意法半導體,M是Microelectronics的縮寫,32表示32位,合起來理解,STM32就是指S…

Multisim使用教程詳盡版--(2025最新版)

一、Multisim14前言 1.1、主流電路仿真軟件 1. Multisim:NI開發的SPICE標準仿真工具,支持模擬/數字電路混合仿真,內置豐富的元件庫和虛擬儀器(示波器、頻譜儀等),適合教學和競賽設計。官網:艾…

分布式理論和事務

微服務和分布式 微服務 是一種軟件架構風格,它將應用程序拆分成一系列小型、獨立的服務,每個服務專注于單一功能,彼此通過輕量級通信機制(如 API)進行交互。微服務通常是松耦合的,可以獨立開發、部署和擴展…

JAVA:紅黑樹應用的技術指南

🌳 1、簡述 紅黑樹是一種自平衡二叉查找樹(Self-Balancing Binary Search Tree),被廣泛應用于操作系統調度、Java集合、數據庫索引等核心模塊中。本文將從 基本原理 入手,結合 實際應用場景與代碼實例,帶你…

【Pandas】pandas DataFrame rfloordiv

Pandas2.2 DataFrame Binary operator functions 方法描述DataFrame.add(other)用于執行 DataFrame 與另一個對象(如 DataFrame、Series 或標量)的逐元素加法操作DataFrame.add(other[, axis, level, fill_value])用于執行 DataFrame 與另一個對象&…

【數據可視化-26】基于人口統計與社會經濟數據的多維度可視化分析

?? 博主簡介:曾任某智慧城市類企業算法總監,目前在美國市場的物流公司從事高級算法工程師一職,深耕人工智能領域,精通python數據挖掘、可視化、機器學習等,發表過AI相關的專利并多次在AI類比賽中獲獎。CSDN人工智能領域的優質創作者,提供AI相關的技術咨詢、項目開發和個…

WinForm真入門(18)——DateTimePicker?控件解析

一、基本概念? ?DateTimePicker? 是 Windows 窗體中用于選擇日期和時間的控件,支持以下交互方式: 通過下拉日歷選擇日期通過上下按鈕調整時間直接輸入日期或時間 適用于需要規范日期格式、限制日期范圍或快速輸入的場景(如預約系統、數據…

AVFormatContext 再分析

說明 :將 avfromatContext 的變量依次打印分析,根據ffmpeg 給的說明,猜測,結合網上的文章字節寫測試代碼分析。 從常用到不常用依次分析 1. unsigned int nb_streams; 代表 avfromatContext 中 AVStream **streams 的個數 /** …

計算機網絡-運輸層(1)

計算機網絡-運輸層(1) 文章目錄 計算機網絡-運輸層(1)5.1 運輸層概述5.2 運輸層端口號、復用與分用端口號基本概念端口號特性端口號分類重要說明 5.3 UDP與TCP協議對比關鍵區別說明 5.1 運輸層概述 計算機網絡體系結構中的物理層、數據鏈路層以及網絡層共同解決了主機通過異構…

2025 FIC wp

這次比賽計算機和手機大部分題目都比較常規 第一和第四部分有點讓人摸不著頭腦 比賽的時候第一部分有四個題沒出 第四部分基本都沒怎么出 現在復盤一下 把我當時做題的心得和獲取的新知識記錄一下 互聯網取證的部分就先學習一下別的師傅 檢材 鏈接:https://pan.bai…

【大數據技術-聯邦集群RBF】DFSRouter日志一直打印修改Membership為EXPIRED狀態的日志分析

生產環境遇到下面報錯 2025-04-23 17:44:15,780 INFO store.CachedRecordStore (CachedRecordStore.java:overrideExpiredRecords(192)) - Override State Store record MembershipState: router1:8888->hh-fed-sub25:nn2:nn2:8020-EXPIRED 2025-04-23 17:44:15,781 INFO …