(整理)

平台:       

        造型引擎——ACIS

        显示引擎——Direct3D/OpenGL/GDI
        应用框架——HOOPS
 
组件关系图
 
 
ACIS——造型引擎
ACIS是美国Spatial Technology公司推出的三维几何造型引擎,它集线框、曲面和实体造型于一体,并允许这三种表示共存于统一的数据结构中,为各种3D造型应用的开发 提供了几何造型平台.Spatial Technology公司在1986年成立,目前ACIS 3D Toolkit在世界上已有380多个基于它的开发商,许多著名的大型系统都是以ACIS作为造型内核,如 AutoCAD,CADKEY,Mechanical Desktop,Bravo,TriSpectives,TurboCAD,Solid Modeler,Vellum Solid等。
 
ACIS 核心功能
3D 造型
Ø         将2D曲线经拉伸、旋转、扫掠等操作生成复杂的3D曲面或实体
Ø         高级倒角和圆角操作
Ø         网格曲面生成
Ø         阵列操作
Ø         实体抽壳和曲面加厚
Ø         曲线、曲面和实体的交互式弯曲、扭曲、延展、变形
Ø         曲线、曲面、实体的交、并、差运算
Ø         放样操作
Ø         模型中拔模面生成、曲面等距和移动
3D 模型管理
Ø         在模型的任何级别关联用户自定义的数据
Ø         跟踪几何和拓扑改变
Ø         计算质量和体积
Ø         使用单元拓扑表示实体模型子域
Ø         独立于历史流的无穷次的撤销(undo)和恢复(redo)操作
3D 模型显示
Ø         将曲面几何离散成多边形网格表示
Ø         利用可选可变形造型组件创建高级曲面
Ø         利用可选PHL V5 组件生成带隐藏线消除的精确2D工程图
Ø         利用Spatial提供的Tech Soft America的HOOPS/3dAF以及HOOPS/ACIS Bridge等产品搭建图形交互应用程序
 
ACIS是一个完整的modeling的内核,说白了就是一套用C++写的
modeling类库,只要你掌握了这个库就可以完成所有的建模工作(基本上所有3D造型软件的功能他都有),但是这个库的易用性不够,所以在其上又开发
了一些API进一步对底层的acis类库进行封装,而最上层则是现在非常流行的一中类lisp的解释器平台,应用scheme语言作为上层的开发语言,经
过这么多步骤的封装,你只需要输入(block(0,0,0),(10,10,10))这个命令就能建立一个立方体,其他相似的简单命令就能完成很复杂的
操作,已经相当于AutoCAD里面的命令行模式了。
建立一个模型后不能只存为一个数据文件就完了,我们需要把这个模型显示在计算机屏幕上,并实时对他进行操作,这就需要一个图形显示引擎来干这个事儿了。
HOOPS是一个在底层图形驱动基础上开发的显示类库,他不是一个单独的图形显示引擎,
而是对OpenGL、DirectX这些图形引擎进行封装和扩展的结果。他的最大优势是对大模型操作和显示的优化以及一种压缩比高,适合网络传输的
stream模式。这两者都可以理解为对原有图形引擎的优化,使文件更小,运行更快。当然,灵活的对OpenGL和directX的支持也是其卖
点,HOOPS保证自己能同步跟上OpenGL和DirectX的发展步伐并在其上做有益的改进。
ACIS是一个B-rep建模引擎,它是通过定义几何对象的边界来表达一个实物。边界是可组成一个闭合区域的一系列面的集合。其拓扑结构如下图:
 

Body       模型对象的根结点,是块的集合,能描述线体、板体、实体,也能是几个彼此分离的体的集合,包含0个或多个Lumps。
Lump       空间有界的连通的区域。用Shell约束的点的集合,一个实体上附加一个悬挂面也称为Lump。
Shell       一系列连通的Face / Wire 的集合。线、面的集合,能位于实体外,也能在内部形成空洞。一个体含一个悬挂面,一个体内嵌许多和外表面相连的面都称为shell。
Face               广义的面。ACIS能定义无限薄的双面或单面(这种情况下,单面法向量指向面的一侧,实体材料存在于另一侧)。
Loop        a connected series of coedges, Closed
Wire         not attached to faces
Coedge    Edge被多个Face引用。ACIS中允许边是一个、两个或多个面的交线,因此它能描述二流形体和非流形体。一条边由两条共边(有时也是单条共边)组成。
Edge             one or more vertices。边是多个面的交线时(形成非流形体),半边保存顺序非常重要,用它来决定面的发散方向。
 
Vertices
 
Body处于最上层,它可以由任意的拓扑元素组成。几个不共点的Body可看作一个
Body。Body可以有任何数目的Lumps。Lumps代表空间中一个约束的连接的区域。一个Lumps是一系列整个相连点集,而不论它们是三维、二
维、一维或是它们的混合。因此一个实体带有一个悬挂面的是一个Lumps,而两个不相连的薄面则代表两个Lumps。Shell是一系列整个相连的面。一
个实体带有一个悬挂面的是一个Shell,而一个实体带有一个不相连的面则是两个Shell。Subshells
不能够通过API来访问,它基本上不直间使用。一个FACE是空间一个几何表面,Face的边界是由Loops构成的。Loops是由一系列相连的
Coedge所组成。Coedge记录的是一个面Loops的中的一条边。引入是Coedge为了表示多个面共边,这就使得流体和非流体的造形成为可能。
对于Coedge很重要的一点是要理解它的方向性。在Coedge类中有很多指针,可指向它的相邻,前一个,后一个等等,这就使得在进行模型的遍历时是很
方便的。拓扑模型的遍历就是一个从上到下的循环查找的过程。
 
HOOPS——应用程序框架
在3D应用程序开发早期,虽然直接使用OpenGL或Direct3D等图形编程接口就
可以满足一般的可视化需要,但如果3D应用程序需要更加高级的图形功能(如隐藏线消除,高级渲染和贴图、动画、文字处理、2D矢量图输出、高级动画等)或
需要对图形性能进行优化时,开发人员还需要做大量的工作,如建立自己的图形数据库以及对包括OpenGL、Direct3D在内的多种硬件驱动提供支持
等,而这些图形功能的实现需要很多专业图形开发人员通过多年的努力才可能完成。
   为了使用户能够快速开发出高品质的3D应用程序,Spatial公司不仅提供了
ACIS造型组件、InterOp数据接口组件,还和著名的可视化组件开发商美国TSA公司进行紧密合作,提供HOOPS可视化组件的授权和技术服务,使
用户可以在更高层次的图形平台上开发3D软件,从而提升软件产品的竞争力,降低开发成本并加快产品上市。
HOOPS组件是建立在OpenGL、Direct3D等图形编程接口之上的更高级别的应用程序框架,由美国TSA公司开发并由TSA和Spatial公司负责发布和提供技术支持。
HOOPS不仅为软件开发人员提供了强大的图形功能,如高质量的模型显示、便捷的人机交
互、包括OpenGL和Direct3D在内的多种渲染管道的支持、高级渲染、2D图形的矢量化输出、动画、动态干涉检查以及图形数据流化处理等,此外
HOOPS中还内嵌了多边形优化和大模型处理等技术,能够大大提高3D可视化的性能。另外HOOPS开发包中提供的大量应用程序级的实例源码,可以帮助用
户在很短的时间内搭建出商业级的3D图形应用程序。
HOOPS组件按功能可进一步分为HOOPS/3dAF、HOOPS/Stream以及
H O O P S / N E
T三个子组件,其中HOOPS/3dAF组件是一个3D图形应用程序框架,采用了保留模式的图形数据库和多种渲染管道来管理和绘制图形对象;HOOPS
/Stream组件可以用来对场景图数据进行流化处理;而HOOPS/NET组件则可以用于网络协同。这三个子组件既可以单独授权,也可以结合在一起使
用。
HOOPS和ACIS、InterOp、Direct3D/OpenGL之间的关系
    HOOPS组件不但可以单独用于3D模型的可视化,而且可以和其他造型内核(如ACIS)和数据接口组件(如InterOP)结合使用。下图所示非常直观地说明了HOOPS和ACIS、InterOp之间的关系以及如何使用这三个组件来构建3D应用程序的基本框架。
    3D应用程序通过HOOPS/GUI和ACIS、HOOPS组件建立连接,从而实现利用ACIS内核进行造型,并利用HOOPS组件进行可视化和人机交互。ACIS和HOOPS之间通过HOOPS/ACIS bridge来进行通信,从而实现文档和视图分开;InterOp组件用于读写实现ACIS模型和其他格式3D模型之间的相互转换;HOOPS/Stream组件则可用于读写3D场景图数据。
              利用HOOPS、ACIS和InterOp开发3D应用程序的框架
说明:
1.HOOPS/3dAF( 3D Application Framework
The
HOOPS 3D Application Framework (HOOPS/3dAF) consists of an integrated
suite of toolkits that are used to build commercial 3D graphics
applications.  HOOPS/3dAF provides a flexible architectural foundation
based on a series of modular application components, which enable the
rapid development and maintenance of high-performance design,
visualization, and engineering packages. HOOPS/3dAF maintains platform
independence within each component, providing comprehensive
cross-platform solutions on Windows, UNIX, LINUX, Mac OS X and the
Internet.
The HOOPS 3D Application Framework consists of the following components:
n         HOOPS/3dGS - HOOPS 3D Graphics System 
n         HOOPS/Stream - The HOOPS Stream Toolkit
n         HOOPS Model/View/Operator (MVO) Class Library 
n         HOOPS/GUI - Graphical User Interface Modules 
n         HOOPS/GMB - Geometric Modeler Bridges 
 
The
diagram below illustrates how these components are connected to each
other and how user generated events flow from the GUI Toolkit to the
HOOPS/3dAF.
 
The HOOPS 3D Application Framework
User-generated
events are collected by a GUI Tool's event queue. The HOOPS/GUI
integration module monitors the event queue and dispatches appropriate
events to either the HOOPS/MVO objects, HOOPS/Net client objects, or
directly to HOOPS/3dGS. The HOOPS/MVO application objects in turn engage
the API of either the geometric modeler, HOOPS/GMB, HOOPS/Net, or
HOOPS/3dGS itself to interact with the data stored in each component. 
 
2。HOOPS/GUI - Graphical User Interface Modules 
The Graphical User Interface Integrations
encapsulate the work needed to connect the HOOPS/3dAF to several
different Graphical User Interface (GUI) toolkits. Currently HOOPS/GUI
modules exist for:   
Ø         Microsoft Foundation Classes (MFC) on Windows  
Ø         Qt Toolkit for cross platform GUI development 
Ø         ActiveX Control Classes on Windows  
Ø         MOTIF Toolkit on UNIX  
 
3.HOOPS/ACIS桥(HOOPS/GMB)
The HOOPS/ACIS Bridge encapsulates the work needed to connect ACIS modeler from Spatial to the HOOPS/3dGS.
The
bridge provides an API for controlling the manner in which ACIS'
geometric tessellation is mapped to HOOPS primitives, and for finding
exactly which HOOPS segment entity corresponds to which ACIS entity and
vice versa. The HOOPS/ACIS Bridge is supplied as a dynamic linked
library (dll) with an exposed API. 
Building
a two-way connection between ACIS and the HOOPS/3dGS involves accessing
the geometric data in ACIS and mapping it the appropriate set of
geometric primitives in HOOPS
A class that implementsIEntityConverter performs the conversion of ACIS ENTITYs to HOOPS segments
The HOOPS/ACIS Bridge routine HA_Render_Entities will initiate the flow of geometric information from ACIS to the HOOPS/3dGS. The HA_Render_Entities routine accepts a list of ACIS entities and then calls the registered IEntityConverter class to convert the ACIS ENTITYs to HOOPS segments.
 
Creating and Rendering ACIS Entities
Rendering ACIS entities is performed by calling HA_Render_Entity or HA_Render_Entities.
Defining ACIS Geometry
A sphere, along with many other predefined ACIS objects, is represented by a BODY entity, and is created via the routine:
<outcome>= api_make_sphere(<radius>, <sphere_body>);
The following code demonstrates how to create an ACIS sphere. Note that it calls HA_Render_Entity.
 
// create an acis sphere and return the sphere's body id
BODY* HOpCreateSolidSphere::CreateSolidSphere(HPoint & center, float radius)
{
 BODY* sphere_body;
vector translate_vector;
transf delta_transf;
outcome o;
translate_vector.set_x(center.x);
translate_vector.set_y(center.y);
translate_vector.set_z(center.z);
delta_transf = translate_transf(translate_vector);
o = api_make_sphere(radius, sphere_body);
o = api_transform_entity(sphere_body, delta_transf);
assert(o.ok());
// before rendering bodies, check if this view is in 'merge faces'
// mode or not, and ensure that the rendering option is set
// accordingly.  This is necessary because the HOOPS/GM Rendering
// Options are procedural; they set the current state of the bridge,
// and we need to make sure that all parts in each view object are
// rendered in a consistent mode
if (((HSolidView*)GetView())->GetOptimizations())
 HA_Set_Rendering_Options("merge faces");
else
 HA_Set_Rendering_Options("no merge faces");
// now put it in the HOOPS database
HA_Render_Entity((ENTITY*)sphere_body);
((HSolidModel*)m_pView->GetModel())->AddAcisEntity(sphere_body);
return sphere_body;
}
Inserting ACIS Geometry into the HOOPS database
//Read Sat file
// strPartFilePathsat文件路径名
ENTITY_LIST entList;
CFile SatFile = fopen (strPartFilePath, "rt");
outcome oRes = api_restore_entity_list(satFile, TRUE, entList);   
//将多余的边去除,以达到使圆柱侧面为一个完整周期曲面的目的
entList.init();
ENTITY* entity = entList.next();
while(entity != NULL)
{
    oRes = api_clean_entity(entity);
    entity = entList.next();
}
entList.init();
 
// ACIS entity map to HOOPS segment
HC_Open_Segment_By_Key(key);
    entList ->init();
    ENTITY* ent =pList->next();
    while(ent != NULL)
   {
        HA_Render_Entity(ent);
        ent = pList->next();
    }
HC_Close_Segment();
 
 
//HA_Render_Entity()函数内部调用上面提到的IEntityConverter接口
HC_KEY HA_Render_Entity(ENTITY* entity, const char* pattern)
{
extern IEntityConverter *s_pIEntityConverter;
ENTITY *owner = NULL;
 。。。。。。
api_get_owner( entity, owner );
pattern = s_RenderingOptions.GetPattern();
key=s_pIEntityConverter->ConvertEntity(owner,s_RenderingOptions,map,pattern)
。。。。。。
};
 
// delete the ACIS body
void HSolidModel::DeleteAcisEntity( ENTITY* entity)
{
   ENTITY_LIST elist;
   elist.add(entity);
   HA_Delete_Entity_Geometry(elist);
    api_del_entity(entity);
}
 
The
HOOPS/ACIS Bridge maps the tessellation of all ACIS entities to HOOPS
geometric primitives, inserting zero or more new HOOPS geometric
primitives into the HOOPS database for each ACIS entity encountered. 
While each ACIS entity uses a pointer for access, HOOPS entities have
“keys” that are long integers and are passed to routines when accessing
the entity. The HOOPS/ACIS Bridge routines HA_Compute_Entity_Pointer and HA_Compute_Geometry_Keys can be used for converting ACIS pointers to HOOPS keys and vice versa.
 
Operating on ACIS Entities
When
performing operations that modify ACIS entities, it is necessary to
keep the HOOPS representation of the model synchronized with its ACIS
representation. Because such operations are typically initiated by
selecting (hit testing) HOOPS geometric objects, it is necessary to
determine which ACIS entity(s) correspond with the selected HOOPS
entities, and vice versa. The HOOPS/ACIS Integration includes routines
that support this requirement.
HOOPS
geometric entities are identified by a HOOPS 'key'.  Recall that ACIS
entities are referred to by an ACIS pointer. Given a HOOPS key, the HA_Compute_Entity_Pointer function will return the ACIS pointer for the ACIS entity associated with that key. Conversely, given an ACIS pointer, the HA_Compute_Geometry_Keys
function will return all the HOOPS keys for the tessellated geometry or
the HOOPS segment associated with the ACIS entity. (Recall that an ACIS
entity might be represented by more than one HOOPS geometric entity.)
 
Accessing an ACIS Entity
Selection
on the HOOPS scene returns the key(s) of HOOPS geometry, requiring us
to find the ACIS entity that is associated with the selected HOOPS
geometry. If we wanted to access the ACIS 'body' entity given the key of
a selected HOOPS geometric primitive, we would call:
BODY*  entity = (BODY*)HA_Compute_Entity_Pointer(key, BODY_TYPE);
We
can now use the pointer of the ACIS entity to perform ACIS operations,
or to access the HOOPS geometric primitives that represent the ACIS
entity.
 
 
4.HOOPS/MVO Model/View/Operator
Model : Application data 
View : Representations of the application data 
Operator : Algorithms that operate on the application data 
The user
of the application operates on the model via the views of the model.
Views are designed specifically to facilitate a given model interaction
such as data creation or editing. Views can "look at" multiple models
and models can "be seen" by multiple views (a many to many mapping).
Operators are associated with views.
In HOOPS,
3D objects are organized into segments containing geometry, attributes
and sub-segments. For each application, the 3D model maps to some
section of the HOOPS segment tree, typically in the Include Library.
Views are mapped to HOOPS driver instance segments with camera and
window attributes. The model is either directly built under the driver
instance segment or included from another spot in the segment tree. This
relationship of HOOPS model to HOOPS views is generic and applicable to
most applications built with HOOPS. 
Operators
consist of the application code that manipulates the application data.
When building HOOPS-MVO applications, the operators use the HOOPS API,
along with other component or application-specific APIs, to manipulate
the data stored in both HOOPS and application-specific data structures.
The
HOOPS/MVO Classes provide a HOOPS-specific implementation of the 
model/view/operator paradigm, which may be directly incorporated into an
application and extended. 
MVO's HOOPS 3dGS Segment Structure
The class
library builds higher level objects for the model and view out of HOOPS
segment structures. The HBaseModel object is built out of the include
library and the HBaseView object is built out of HOOPS driver segment
instances. View objects also build an initial segment structure for
managing the inclusion of model objects, interacting with user input,
lighting of the scene, etc... 
 
5.HOOPS/3dGS3D Graphics System
HOOPS/3dGS
provides the algorithms for creating, editing, manipulating, and
querying the graphics information stored in the database
The
HOOPS/3dGS Graphics System, illustrated in Figure 1, consists of 2
major subcomponents: a graphical object database called the HOOPS/3dGS
Segment Tree, and a rendering pipeline called the HOOPS/3dGS Structured
Device Interface.
The Object Database
The
HOOPS/3dGS database stores graphical data in objects called "segments".
Think of a segment as a container for geometry and attributes that
describe how the geometry is to be drawn..
The HOOPS/3dGS graphics database stores graphics scenes as a hierarchy of segments,
which lends itself naturally to organizing graphics information.  In
terms of object-oriented programming, think of a segment as an object.
6.HOOPS/Stream
HOOPS/Stream
is a set of platform and GUI-independent C++ classes that provide
support for creating and reading HOOPS Stream Files (HSF's) or data
streams containing 2D & 3D scene-graph objects, attributes, and any
kind of specialized application-specific data.
HOOPS/Stream's
open architecture allows developers to create and read custom,
stream-enabled HSF files that are tailored to a particular application's
needs. Its flexibility of design enables the creation of an endless
variety of streaming formats, file extensions, file interaction
strategies (including client/server interaction), data transfer
techniques, and more...all with advanced data compression and full
object and attribute support.
HOOPS/Stream
is independent from other HOOPS modules, in that its usage does not
require the application's architecture to be based on HOOPS/3dAF. Any
application using a proprietary scene graph, as well as those that use
HOOPS/3dAF, can implement HOOPS/Stream.
 

基于ACIS/HOOPS的3D应用开发简介 【转】的更多相关文章

  1. 一款基于HTML5的Web 3D开发工具

    在我们协助客户进行3D应用的开发过程中,客户遇到的最头疼的问题是如何在短时间内学会使用TWaver 3D引擎,以及使用TWaver 3D来创建和导入项目所需的各种3D业务模型.由于项目涵盖的行业繁多. ...

  2. 基于Lua的游戏服务端框架简介

    基于Lua的游戏服务端框架简介 [转]https://gameinstitute.qq.com/community/detail/106396 基于lua的游戏服务端框架简介 1. 引言 笔者目前在参 ...

  3. 5 个最好的3D游戏开发工具(转)

    转自:http://www.open-open.com/news/view/33a4f0 5 个最好的3D游戏开发工具 jopen 2012-11-19 22:56:21 • 发布 摘要:UDK(th ...

  4. 基于HTML5的燃气3D培训仿真系统

    最近上线了的基于HTML5的燃气3D培训仿真系统,以前的老系统是采用基于C++和OpenGL的OpenSceneGraph引擎设计的,OSG引擎性能和渲染效果各方面还是不错的,但因为这次新产品需求要求 ...

  5. 基于 HTML5 WebGL 的 3D 网络拓扑图

    在数据量很大的2D 场景下,要找到具体的模型比较困难,并且只能显示出模型的的某一部分,显示也不够直观,这种时候能快速搭建出 3D 场景就有很大需求了.但是搭建 3D 应用场景又依赖于通过 3ds Ma ...

  6. Unity 3D游戏开发引擎:最火的插件推荐

    摘要:为了帮助使用Unity引擎的开发人员制作更完美的游戏.我们精心挑选了十款相关开发插件和工具.它们是:2D Toolkit.NGUI.Playmaker.EasyTouch & EasyJ ...

  7. 基于Azure的软件部署和开发系列沙龙

    活动简介: Azure是一种灵活和支持互操作的平台,它可以被用来创建云中运行的应用或者通过基于云的特性来加强现有应用.它开放式的架构给开发者提供了Web应用.互联设备的应用.个人电脑.服务器.或者提供 ...

  8. Webservice WCF WebApi 前端数据可视化 前端数据可视化 C# asp.net PhoneGap html5 C# Where 网站分布式开发简介 EntityFramework Core依赖注入上下文方式不同造成内存泄漏了解一下? SQL Server之深入理解STUFF 你必须知道的EntityFramework 6.x和EntityFramework Cor

    Webservice WCF WebApi   注明:改编加组合 在.net平台下,有大量的技术让你创建一个HTTP服务,像Web Service,WCF,现在又出了Web API.在.net平台下, ...

  9. 基于 webGL 的元素周期表 3D 交互展示

    前言 之前在网上看到别人写的有关元素周期表的文章,深深的勾起了一波回忆,记忆里初中时期背的“氢氦锂铍硼,碳氮氧氟氖,钠镁铝硅磷,硫氯氩钾钙”.“养(氧)龟(硅)铝铁盖(钙),哪(钠)家(钾)没(镁)青 ...

随机推荐

  1. HDU 5371 Manacher Hotaru's problem

    求出一个连续子序列,这个子序列由三部分ABC构成,其中AB是回文串,A和C相同,也就是BC也是回文串. 求这样一个最长的子序列. Manacher算法是在所有两个相邻数字之间插入一个特殊的数字,比如- ...

  2. mysql中的存储引擎

    MySQL中常用的几种存储引擎:innoDB.bdb.myisam.memory以及这几个引擎的讲解: InnoDB存储引擎: (1) innodb存储引擎该mysql表提供了事务,回滚以及系统崩溃修 ...

  3. hdu1787 GCD Again poj 2478 Farey Sequence 欧拉函数

    hdu1787,直接求欧拉函数 #include <iostream> #include <cstdio> using namespace std; int n; int ph ...

  4. 包含min函数的栈 【微软面试100题 第二题】

    题目要求:定义栈的数据结构,请在该类型中实现一个能够得到栈的最小元素的min函数.在该栈中,调用min.push及pop的时间复杂度都是O(1). 参考题目:剑指offer第21题. 题目分析: 1. ...

  5. 用Python表达对Android的想法

    组员:喻航,张子东 视频:点我 #DISCARD ANDROID TODAY! import turtle import turtle as gui #setting turtle.screensiz ...

  6. zabbix2.4升级到2.5 --考虑升级到zabbix3.0

    现在zabbix服务器,zabbix服务日志频繁出现MySQL server  has gone away,经搜索,此问题在zabbix2.5之前是zabbix的一个bug,zabbix2.5后已经修 ...

  7. 九度oj 1003

    前几天开刷九度oj,准备把做的题都放上,先放1003 题目1003:A+B             时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:16923 解决:7029 题目描述: 给 ...

  8. Thinkphp5.1手册太简单,有的功能用起来不确定结果是否和预料的一样,顾整理记录

    //模板{if false} 1 {else/} //====>可以使用 效果同 {else /} 2 {/if} {if condition="(1 eq 1) and false& ...

  9. HashMap源码分析jdk1.6

    HashMap数组每个元素的初始值为NULL  1.定义 public interface Map<K,V> { int size(); boolean isEmpty(); boolea ...

  10. BZOJ4033 [HAOI2015]树上染色 【树形dp】

    题目 有一棵点数为N的树,树边有边权.给你一个在0~N之内的正整数K,你要在这棵树中选择K个点,将其染成黑色,并 将其他的N-K个点染成白色.将所有点染色后,你会获得黑点两两之间的距离加上白点两两之间 ...