Skip to content

Instantly share code, notes, and snippets.

Philippe Leefsma leefsmp

Block or report user

Report or block leefsmp

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View re-flex-demo-handle.jsx
/////////////////////////////////////////////////////////
// Re-Flex handle element demo
//
/////////////////////////////////////////////////////////
class ReflexHandleDemo
extends React.Component {
render () {
return (
View re-flex-demo-collapse.jsx
/////////////////////////////////////////////////////////
// Re-Flex Size Collapsible element demo
//
/////////////////////////////////////////////////////////
class CollapsibleElement extends React.Component {
componentWillReceiveProps (nextProps) {
if (this.props.onCollapse &&
this.getSize() < this.props.threshold) {
@leefsmp
leefsmp / ReactPie.js
Last active Jan 9, 2018
A responsive PieChart in pure React + SVG
View ReactPie.js
/////////////////////////////////////////////////////////
// ReactPie: a responsive PieChart in pure React + SVG
// by Philippe Leefsma, Jan 2017
//
/////////////////////////////////////////////////////////
import PieSegment from './ReactPieSegment'
import ReactTooltip from 'react-tooltip'
import Measure from 'react-measure'
import PropTypes from 'prop-types'
import Stopwatch from 'Stopwatch'
@leefsmp
leefsmp / PointCloudMarkup.js
Last active Dec 10, 2019
High-performance markup 3D for Forge Viewer
View PointCloudMarkup.js
///////////////////////////////////////////////////////////
// PointCloudMarkup: high-perf markup 3D for Forge Viewer
// by Philippe Leefsma, December 2017
//
///////////////////////////////////////////////////////////
import EventsEmitter from 'EventsEmitter'
import defaultTex from './texture.png'
export default class PointCloudMarkup extends EventsEmitter {
@leefsmp
leefsmp / Viewing.Extension.MeshSelection.js
Created Dec 4, 2017
Forge Viewer MeshSelectionExtension
View Viewing.Extension.MeshSelection.js
/////////////////////////////////////////////////////////////////////
// MeshSelectionExtension, written by Philippe Leefsma - Dec 2017
//
// Illustrates how to perform double ray casting to detect selection
// of custom meshes added to the scene and handle occlusion with
// Viewer meshes from loaded model.
//
/////////////////////////////////////////////////////////////////////
class MeshSelectionExtension extends Autodesk.Viewing.Extension {
@leefsmp
leefsmp / Viewing.Extension.ViewableSelector.js
Created Nov 9, 2017
Creates a React panel to switch between viewable items in a Forge Viewer document
View Viewing.Extension.ViewableSelector.js
/////////////////////////////////////////////////////////
// Viewing.Extension.ViewableSelector
// by Philippe Leefsma, November 2017
//
/////////////////////////////////////////////////////////
import MultiModelExtensionBase from 'Viewer.MultiModelExtensionBase'
import './Viewing.Extension.ViewableSelector.scss'
import WidgetContainer from 'WidgetContainer'
import ReactTooltip from 'react-tooltip'
import ServiceManager from 'SvcManager'
@leefsmp
leefsmp / MultiModelStructurePanel.js
Last active Oct 10, 2017
A patch for Autodesk.Viewing.Extensions.ViewerModelStructurePanel to support multi-models. Just include the script it will override required viewer prototypes
View MultiModelStructurePanel.js
'use strict';
/**
* TreeOnDemand view control
* @constructor
* @param {TreeDelegate} treeDelegate
* @param {Object} root - A node in the model Document
* @param {HTMLElement} parentContainer - DOM element parent of the tree.
* @param {Object} options
*/
@leefsmp
leefsmp / upload.js
Last active Oct 9, 2017
Uploading a resumable resource to Forge OSS (node.js)
View upload.js
/////////////////////////////////////////////////////////
// upload resource
//
/////////////////////////////////////////////////////////
router.post('/buckets/:bucketKey',
uploadSvc.uploader.any(),
async(req, res) => {
try {
@leefsmp
leefsmp / uploadObjectChunked.js
Last active Oct 9, 2017
Forge resumable upload (node.js)
View uploadObjectChunked.js
/////////////////////////////////////////////////////////
// Uploads object to bucket using resumable endpoint
//
/////////////////////////////////////////////////////////
uploadObjectChunked (
getToken,
bucketKey, objectKey,
file,
opts = {}) {
@leefsmp
leefsmp / GeometryIntersectsBox3.js
Created Sep 25, 2017
Three.js Geometry/Box3 intersection helper
View GeometryIntersectsBox3.js
//From https://github.com/yvt/threejs-geometry-hittest
let norm = new THREE.Vector3()
let t1 = new THREE.Vector3()
let t2 = new THREE.Vector3()
let depth = 0
function checkBoxSeparation(
phase,
minX, minY, minZ,
You can’t perform that action at this time.