npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

miniocc

v0.0.9

Published

wrapper for opencascade.js

Downloads

6

Readme

使用miniocc.js步骤

1.添加库依赖

  • 使用如下命令引入miniocc

    npm install --save miniocc

2.使用例子,创建一个立方体

搭建一个vue的项目(具体步骤自行百度),在App.vue中写下如下代码 :

import { InitializeScene } from './initialize_scene'
import { onMounted } from 'vue'
import * as THREE from 'three';
import { getProducer } from 'miniocc'  // 获得miniocc抽象工厂实例

export default {
  name: 'App',
  setup() {
    onMounted(()=>{
        const scene = InitializeScene();
        getProducer(true).then((producer) => {
          // 获取Geometry构造器
          let geometryBuilder = producer.getGeometryBuilder();
          // 获取Shape构造器
          let shapeBuilder = producer.getShapeBuilder();
          // 获取Mesh数据构造器
          let meshBuilder = producer.getMeshBuilder();
          // 获取Box左上和右下的两个坐标点
          let p1 = geometryBuilder.buildPoint3D(0,0,0);
          let p2 = geometryBuilder.buildPoint3D(10,10,10);
          // 构建Box
          let box = shapeBuilder.buildBox(p1,p2);
          // 释放资源
          p1.dispose();
          p2.dispose();
          // 构造Three.js所需的Mesh顶点数据
          let vertices = metaDataBuilder.toMesh(box);
          const geometry = new THREE.BufferGeometry();
          geometry.setAttribute('position', new THREE.Float32BufferAttribute(vertices, 3));
          let material = new THREE.MeshBasicMaterial({
                color: new THREE.Color("pink")
          });
          let object = new THREE.Mesh(geometry,material);
          scene.add(object);
          // 释放资源
          box.dispose();
        }).catch(error => {
          console.log(error);
        });
    });
  },
}

initialize_scene.js中的代码如下:

import {AmbientLight,DirectionalLight,PerspectiveCamera,Scene,WebGLRenderer} from'three';
import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls.js';

const InitializeScene = ()=> {
    let scene = new Scene();
    let camera = new PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000 );
    let renderer = new WebGLRenderer({ antialias: true });
    renderer.setSize(window.innerWidth, window.innerHeight);
    document.body.appendChild( renderer.domElement );
    const light = new AmbientLight(0x404040);
    scene.add(light);
    const directionalLight = new DirectionalLight(0xffffff, 0.5);
    directionalLight.position.set(0.5, 0.5, 0.5);
    scene.add(directionalLight);
    camera.position.set(0, 50, 100);
    const controls = new OrbitControls(camera, renderer.domElement);
    controls.screenSpacePanning = true;
    controls.target.set(0, 50, 0);
    controls.update();
    function animate() {
      requestAnimationFrame(animate);
      renderer.render(scene, camera);
    }
    animate();
    return scene;
}
export { InitializeScene }

构建的立方体如下所示:

Release V1.0.4

  • 新增函数
  // 获取形体构造器
  getShapeBuilder():ShapeBuilder;
  // 获取拓扑构造器
  getTopographyBuilder():TopographyBuilder;
  // 获取几何体构造器
  getGeometryBuilder():GeometryBuilder;
  // 获取Mesh构造器
  getMeshBuilder():MetaDataBuilder;

Release V1.0.10

  • 新增列表
  • MathUtils类
  • 角度转弧度函数
static angleToRadian(angle:number):number;
  • 弧度转角度函数
static radianToAngle(radian:number):number;
  • Quaternion类
  • 资源释放函数
dispose():void;
  • 修改列表
  • Face类
  • 沿管道生成形体函数
pipe(curve:Curve):Shape;
  • Wire类
  • 沿管道生成形体函数
pipe(curve:Curve):Shape;
  • Shape类
  • 平移函数
translate(vector:Vector3D):this;
  • 缩放函数
scale(point:Point3D,scaling:number):this;
  • 旋转函数1
rotateAlongAxis(axis:Axis,angle:number):this;
  • 旋转函数2
rotate(quaternion:Quaternion):this;
  • GeometryBuilder类
  • 生成四元角函数
buildQuaternion(x:number,y:number,z:number,w:number):Quaternion;
  • 其它
  • 提供两个开发版本和生产版本的miniocc,通过在getProducer函数调用中传入true or false 来做控制。 原函数:
getProducer():Promise<BuilderProducer>;

修改后:

getProducer(debug:boolean = false):Promise<BuidlerProducer>;